Help with UnLoad event (1 Viewer)

ejstefl

Registered User.
Local time
Today, 08:53
Joined
Jan 28, 2002
Messages
378
Hello,

I have a form that I use for navigation in my database. It consists of links to the left to swith between forms, and a subform in the middle. When a link to the left is clicked, I run code to switch the source fo the subform:

Code:
me.subfrmFrame.SourceObject = "frmSubCustodian"

I want the form to "remember" the last record the user was on, so I created a table and am writing the primary key of the form to the table on the form's unload event. Then, on the form's load event, I'm looking up that key from the table.

When I open and close the form by itself, not as a subform of my navigation form, everything works fine.

When I open the form from the navigation screen, everything is fine.

When I switch to another form on the navigation screen, however, I have a problem. No matter what record the form was on, it always writes the primary key of the very first record.

Can anyone shed some light on this?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:53
Joined
Feb 19, 2002
Messages
43,396
By the time the Unload event fires, there is no longer a current record. You can move the save to the Current event. This will save the current record ID every time it changes. it is a bit of overkill but there is no event that will work if the unload event doesn't do it.
 

Users who are viewing this thread

Top Bottom