Open Form on Last Record Accessed

Tophan

Registered User.
Local time
Today, 01:20
Joined
Mar 27, 2011
Messages
389
I have a macro in the On Open event to refresh the form on opening; however, it always takes me to the first record when opened.

Is there a way to refresh and return to the last record accessed on the form? This could be any record on the form, not necessarily the exact last record (e.g., return to record #7 of 10).

I’ve been using this db for about 3 years now and didn’t have a problem with the form opening on the first record until today. I am searching for a particular occurrence so as I navigate through the records I occasionally have to run a print screen report; once that report closes it takes me right back to the beginning which is making this process quite tedious.

Any suggestions?
 
For starters, why close the form when running the report? You can leave it open, hidden if necessary. If you want/need to close it, you'll have to save the key field it was on to be able to go back to that record when the form opens. That could be saved in a table, TempVar or global variable.
 
The form closing on running a report was just a setting that wasn't a problem until today. I'll try minimizing instead of closing but I think the issue I was having was that on minimizing the form, new data entered wasn't showing in the report so I think that is probably why I set it to close, so it would update and the report would be current.

The TempVar isn't an action to add to the existing macro is it? Last time I needed help on something you sent me a link to your blog; can you provide a link that would explain how I can do this? For today I'm dragging through as I really need to complete this task before the end of the day but I would like to try fixing in case I have to do this again.

Thanks for your help
 
You can force a save of the record, which may solve your problem, with

If Me.Dirty Then Me.Dirty = False

There's probably a macro equivalent. If you were closing the form to save the record, the above or one of several alternatives should work.. You can adapt this if you end up needing it:

http://www.baldyweb.com/Requery.htm
 
Thanks. I'll give it a try and let you know if I was successful :)
 

Users who are viewing this thread

Back
Top Bottom