RE: Error 2455 (associated with subform reference)



Hi Bruce,

If you have your rowsource set correctly behind your combo box, then there
shouldn't be any need to reset the rowsource in the on current event, just
force a requery like this:

Forms!frmPO!fsubPO_Items.Form!cboDescription.Requery

Hope this helps.

Damian.

"BruceM" wrote:

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?



.



Relevant Pages

  • Error 2455 (associated with subform reference)
    ... Error message 2455 (You entered an expression that has an invalid reference ... The form is a purchase order form, and the subform ... lock some of the controls by looping through them. ...
    (microsoft.public.access.formscoding)
  • Re: multiple subform images per main search form record
    ... sned me email and I will send you the sample database to show images from a continuous subform ... ... get a marker and label all controls with the Name property so when you read through the code, you can see what it is referring to. ... Show Images from Continuous Subform ...
    (microsoft.public.access.formscoding)
  • Re: Sub Form produces #Name? error
    ... I've looked at the second version of the database. ... YEAR textbox in the subform: ... Ken Snell "Robin Chapple" wrote in message ... > I get an error message in the last line of the form when it is> displayed and then if I attempt to type an ID number into the ID field> another new record is offered as shown in the image. ...
    (microsoft.public.access.gettingstarted)
  • Go to New Record Started Producing ERROR
    ... This Database is connected via ODBC connection at several locations. ... I cannot recall exactly what the error message said. ... Also, in this same database, I have a Main form for Employer Information with ... In the Job Order Information subform, ...
    (microsoft.public.access.formscoding)
  • Error in Access 2000, but not in 2002 or 2003
    ... I developed a database in Access 2000 -- but ran into ... problems when I put a filter on a control in a form. ... A form was put as a subform in another form. ... controls, the subform had two controls, named "Phase" ...
    (microsoft.public.access.forms)

Loading