What is the last event when moving from record to record?

  • Thread starter Thread starter Bob Quintal
  • Start date Start date
B

Bob Quintal

What is the last event that fires when moving off of a record. It
needs to give me access to the values of the controls in the
record I am moving off of. Thanks.
There isn't ONE. If you move off a record that has not been edited,
only viewed, then it's the OnCurrent event. If you have edited the
record it's the form's AfterUpdate Event. Those only apply if you move
off a record t5o another record. If you move off the record by closing
the form, then it's the Form_Close event.

What specifically are you trying to do? If you tell that, people can
make better suggestions.
 
What is the last event that fires when moving off of a record. It needs to
give me access to the values of the controls in the record I am moving off
of. Thanks.
 
mscertified said:
What is the last event that fires when moving off of a record. It
needs to give me access to the values of the controls in the record I
am moving off of. Thanks.

Unfortunately there is no "about to leave record" event. There is only a
"just arrived at record" which is the Current event.

If the record you are about to leave has unsaved changes then you will see
BeforeUpdate and AfterUpdate fire before you have actually left the record.
There is no corresponding events for a record that does not have unsaved
changes.
 
In
mscertified said:
What is the last event that fires when moving off of a record. It
needs to give me access to the values of the controls in the record I
am moving off of. Thanks.

If it's really, really important to you, there's a way to simulate a
"RecordExit" event. See this MS KnowledgeBase article:

http://support.microsoft.com/kb/304139
How to programmatically implement a RecordExit event
in Access 2002

I can't say I recommend it, though.

Maybe your needs for the values in the previous record's controls would
be solved by having a set of variables to hold these values defined in
the form's module, at module level. In the form's Current event and the
form's AfterUpdate event, you'd set all of those variables from the
current values of the form's fields. Depending on where you're using
the values you capture, you might need to keep a separate set for the
"record before this one".
 
If it's really, really important to you, there's a way to simulate
a "RecordExit" event. See this MS KnowledgeBase article:

http://support.microsoft.com/kb/304139
How to programmatically implement a RecordExit event
in Access 2002

I can't say I recommend it, though.

Looks terrible to me, as it's not really a RecordExit procedure at
all -- it actually moves back to the record after it's already moved
to the next record.

And it depends on ADO, which is silly, in my opinion.
 
Maybe your needs for the values in the previous record's controls
would be solved by having a set of variables to hold these values
defined in the form's module, at module level. In the form's
Current event and the form's AfterUpdate event, you'd set all of
those variables from the current values of the form's fields.
Depending on where you're using the values you capture, you might
need to keep a separate set for the "record before this one".

Sounds like a perfect situation for a class module for the record.

I'd probably implement the class module as a wrapper around an array
that would be sized for the number of fields needed.

Then I'd have two instances of the class module, one for the current
record, one for the previous.
 
Back
Top