Form: Invoke a change when record is left

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a form, I neeed to invoke a change when a record is left (next, previous,
or exit). How do I do this?
 
Current is the event that fires when you move from one record to another.
There's no other event that does that.

Sounds as though you need to keep track of what record you're on in. When
the Current event fires, modify that record, then update the variable that
holds the detail of the current record.
 
First of all, thank you for helping me.

What I am looking for is a field that will indicate that the record is being
viewed by another user. So I have entered a value of Yes on Current. I need
to change that value to No when they leave the record. (I have reviewd
record locking options on the property of the form, but these options will
not work for what I am looking for).
 
Is the current record the only record that's going to be marked as Yes? If
so, you can use a SQL Update statement to change the value from Yes to No
(UPDATE MyTable SET MYField = 'No' WHERE MyField = 'Yes'), and then set the
field to Yes for the current record.
 
The form I am working in has subforms, I don't think this would work, because
I am not editting the record when the curser is in a subform field.
 
You are trying to implement some sort of Pessimistic Locking: good luck,
especially when the application is closed or the connection link is broken.

(BTW, the use of the OnCurrent event combined with a variable to hold the
last position will also give you some problem when the form is closed
because there will be no OnCurrent event on that.)
 
Sylvain Lafontaine said:
(BTW, the use of the OnCurrent event combined with a variable to hold the
last position will also give you some problem when the form is closed
because there will be no OnCurrent event on that.)


Yes, you're correct about that (and I meant to mention that fact). You'd
need to call the same code in the form's Unload event to handle that
situation.
 
Back
Top