Runtime error - 2456
Please help me to figure out what's wrong here. Thanks in advance,
Here are the tables:
==================
Tbl-1
Class-Name Attribute-Name Code-List-Name
...
Classification MyTest AccessRestrictionCode
â¦
Tbl-2
Code-List-Name Code-List-Type Definition
â¦
AccessRestriction enumerated my def
â¦
Here are the forms:
==================
- [Attribute-subform] on Form-1. A field,ItemID, on the subform.
- Double clicking on the value âCodeâ in the ItemID column of the subform,
- Check table-1 and find a record
Class-Name = âClassificationâ,
Attribute-Name = âMyTestâ
Code-List-Name = âAccessRestrictionCode'
- Then Open up Form-2 which has a Combo box [Code-List-Name] (unbound) with a list of code-list-names in tbl-2
I want to find âAccessRestrictionCodeâ in the combo box, then display other fields (type, definition, source) in a subform on form 2
Here is the code
================
' DblClick event from Form-1
Private Sub code_DblClick(cancel as Integer)
dim cd as string
' call a sub to found cd = AccessRestrictionCode
cd = getCdFromTable_1
' open form 2
DoCmd.OpenForm "Form-2"
' find 'AccessRestrictionCode' in the combo box
if Len(trim(cd)) > 0 then
Dim rs As Object
Set rs = Forms![Form-2].Recordset.Clone
rs.FindFirst "[Code-List-Name] = '" & cd & "'"
If Not rs.EOF Then
Forms![Form-2].Bookmark = rs.Bookmark
(runtime error occurs on the following code. âmyProj data canât find the field â|â referred to in your expression â runtime 2456)
Forms![Form-2].[Code-List-Name] = [Code-List-Name]
end if
end sub
What is wrong for the code "Forms![Form-2].[Code-List-Name] = [Code-List-Name]? What does '|' means here?
Thanks again
Lx
|