"You entered an expression that has invalid reference to the property Form/Report"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyWaterloo
    New Member
    • Dec 2007
    • 135

    "You entered an expression that has invalid reference to the property Form/Report"

    I am trying to open my purchase orders form and go to the last record. In the on open command I do:
    Code:
    DoCmd.GoToRecord , , acLast
    Seems straight forward enough...but I keep getting this message "You entered an expression that has invalid reference to the property Form/Report" before the form opens. After I acknowledge the message the form opens and goes to the last record. How do I X the message.
  • DonRayner
    Recognized Expert Contributor
    • Sep 2008
    • 489

    #2
    The form and thus the recordset has not been loaded during the on open event. You need to perform this task in the "On Load" event.

    Comment

    • MyWaterloo
      New Member
      • Dec 2007
      • 135

      #3
      Thanks, that did it. What's funny is, I have no problem running the DoCmd on open in a diff database. Anyway...your advice did the trick. Thanks.

      Comment

      • jbrumbau
        New Member
        • Sep 2007
        • 52

        #4
        --------------------------------------------------------------------------------

        I was having the same problem when using 2 subforms in a form. Apparently if you call any form's functions before the form is loaded it will produce this error. The fix was moving the failed subform above the one calling the code.
        The load order is subforms first, from top to bottom, followed by the parent form.

        Comment

        Working...