Event firing when exiting a record

  • Thread starter Thread starter DianeM
  • Start date Start date
D

DianeM

I need to check status of several fields as a specific record loses
focus (to initiate a message box). I don't see that there's an event
associated with this step.

The only way I've thought to do this operation is to write code for
the following steps:

Define a variable (integer)
Each time one of the fields I'm checking is modified, the variable
gets amended.
If the variable equals a set value, then pop-up the message box.
Reset the variable after the message has been displayed.

This would work, of course, but I feel there has to be a more elegant
way to perform this check. Can't I just check the status of the fields
as I'm exiting the record, provide the message as necessary, and
provide the user the option to derail the lost focus and go back to
the existing record?

Seems so simple, but I can't figure how to do it.
 
If you want to make sure that all the fields are valid before the record is
saved, use Form_BeforeUpdate.

Anything after that is too late: the record has already made it into your
table.
 
DianeM said:
I need to check status of several fields as a specific record loses
focus (to initiate a message box). I don't see that there's an event
associated with this step.

The only way I've thought to do this operation is to write code for
the following steps:

Define a variable (integer)
Each time one of the fields I'm checking is modified, the variable
gets amended.
If the variable equals a set value, then pop-up the message box.
Reset the variable after the message has been displayed.

This would work, of course, but I feel there has to be a more elegant
way to perform this check. Can't I just check the status of the fields
as I'm exiting the record, provide the message as necessary, and
provide the user the option to derail the lost focus and go back to
the existing record?

Seems so simple, but I can't figure how to do it.

Use the form's On Current event to do the checks.

Keith.
www.keithwilby.com
 
Keith said:
Use the form's On Current event to do the checks.

Keith.
www.keithwilby.com

The current event fires "as you arrive" at a record. The OP wants an event
that fires "as you leave" a record. For a dirty record BeforeUpdate will
work. For a non-dirty record no such event exists.
 
Rick Brandt said:
The current event fires "as you arrive" at a record. The OP wants an
event that fires "as you leave" a record. For a dirty record BeforeUpdate
will work. For a non-dirty record no such event exists.

Whoops, yes, sorry. That was one of those "Oh lord ..." moments.

Keith.
 
Back
Top