B
BruceM
Error message 2455 (You entered an expression that has an invalid reference
to the property Form/Report) suddenly started appearing when code references
the subform control. However, while the code in question is being run or
called from the form's Current event, the error only occurs when the form is
first opened. All other form navigation, and all code (see below) after
that works as it should. The form is a purchase order form, and the subform
is PO line items. The tables are properly related. I set the subform's
Products combo box (so that the list is only of products that vendor sells)
by using a public sub which is called at various times such as the form's
Current event. The called procedure is:
Dim strRowSource As String
strRowSource = "SELECT ProdDescr, ProductID, ProdCode, ProdUnit, " & _
"UnitPrice, SupplierID " & _
"FROM tblProduct " & _
"WHERE SupplierID = Forms!frmPO!SupplierID " & _
"ORDER BY ProdDescr, ProdUnit"
Forms!frmPO!fsubPO_Items.Form!cboDescription.RowSource = strRowSource
The last line is the one that started giving me problems. In earlier
versions of the database it worked OK. I was attempting to find a way to
lock some of the controls by looping through them. I seem to have
succeeded, but even after unlocking the controls I am still stuck with the
error message. If it makes any difference, I set the locked property by
setting the Tag property of the controls I wanted to lock (If ctl.Tag = "99"
Then etc.). I can provide that code, if it matters, but I doubt it does,
since the same subform reference seems to be causing a problem in the form's
Current event, in other code I am using to lock some controls if certain
conditions are met. I can't be certain the subform reference is the
problem, but I do know that it is something the problem code has in common.
I have checked references, compacted the database, decomplied with a command
line switch, compacted again, and still the problem remains. I also created
a new blank database, and imported all of the objects. I also tried
creating a new subform control, and re-writing the lines of code that are
misbehaving. No luck.
I can click through the error messages and the form works as it should, so I
could probably pass over the error message in the code's error handling, but
I don't really want to let an unresolved mystery be part of the database.
Any ideas?
to the property Form/Report) suddenly started appearing when code references
the subform control. However, while the code in question is being run or
called from the form's Current event, the error only occurs when the form is
first opened. All other form navigation, and all code (see below) after
that works as it should. The form is a purchase order form, and the subform
is PO line items. The tables are properly related. I set the subform's
Products combo box (so that the list is only of products that vendor sells)
by using a public sub which is called at various times such as the form's
Current event. The called procedure is:
Dim strRowSource As String
strRowSource = "SELECT ProdDescr, ProductID, ProdCode, ProdUnit, " & _
"UnitPrice, SupplierID " & _
"FROM tblProduct " & _
"WHERE SupplierID = Forms!frmPO!SupplierID " & _
"ORDER BY ProdDescr, ProdUnit"
Forms!frmPO!fsubPO_Items.Form!cboDescription.RowSource = strRowSource
The last line is the one that started giving me problems. In earlier
versions of the database it worked OK. I was attempting to find a way to
lock some of the controls by looping through them. I seem to have
succeeded, but even after unlocking the controls I am still stuck with the
error message. If it makes any difference, I set the locked property by
setting the Tag property of the controls I wanted to lock (If ctl.Tag = "99"
Then etc.). I can provide that code, if it matters, but I doubt it does,
since the same subform reference seems to be causing a problem in the form's
Current event, in other code I am using to lock some controls if certain
conditions are met. I can't be certain the subform reference is the
problem, but I do know that it is something the problem code has in common.
I have checked references, compacted the database, decomplied with a command
line switch, compacted again, and still the problem remains. I also created
a new blank database, and imported all of the objects. I also tried
creating a new subform control, and re-writing the lines of code that are
misbehaving. No luck.
I can click through the error messages and the form works as it should, so I
could probably pass over the error message in the code's error handling, but
I don't really want to let an unresolved mystery be part of the database.
Any ideas?