By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,153 Members | 2,581 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,153 IT Pros & Developers. It's quick & easy.

On form open, expression has invalid reference

P: n/a
Hey there,

I just put the following code:

DoCmd.GoToRecord , , acLast

in the On Open event of my form, which has 2 subforms. The following
error message appears when the form now opens:

"You entered an expression that has an invalid reference to the
property Form/Report." But, after clicking the OK on the msgbox, the
form opens to the last record.

I've used this before without problems. Is this a simple fix?

Thanks much

Arnold
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try putting it in the form's On Load event instead.
On Open fires before the data is loaded, so it doesn't know what the last
record is yet.

HTH
- Turtle
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
Hey there,

I just put the following code:

DoCmd.GoToRecord , , acLast

in the On Open event of my form, which has 2 subforms. The following
error message appears when the form now opens:

"You entered an expression that has an invalid reference to the
property Form/Report." But, after clicking the OK on the msgbox, the
form opens to the last record.

I've used this before without problems. Is this a simple fix?

Thanks much

Arnold

Nov 12 '05 #2

P: n/a
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
Hey there,

I just put the following code:

DoCmd.GoToRecord , , acLast

in the On Open event of my form, which has 2 subforms. The following
error message appears when the form now opens:

"You entered an expression that has an invalid reference to the
property Form/Report." But, after clicking the OK on the msgbox, the
form opens to the last record.

I've used this before without problems. Is this a simple fix?

Thanks much

Arnold

Are you absolutely sure the error message is coming from the main form's
open event? You can set a breakpoint to check this. Is that the complete
code you have, or do you use error handling? Have you made sure the code
all compiles?
In any case, if I wanted to go to the last record, I might use soemthing
like this:

With Me.RecordsetClone
.MoveLast
Me.Bookmark = .Bookmark
End With
Fletcher
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.