How to tell if a field on a form has changed? A control?

R

rc51wv

Is there a control that returns a variable that will let you know if
information in a field on a form that has a table set as it's recordsource
has changed from the table?

Say field PIN has had the number changed from what was there when the form
was loaded, is there a control that will return a true/false answer that I
can use on at close to let me know that the field has changed?

Right now all I have is storing the initial values from the fields on the
form in a global variable and then comparing them on close to see if that
information is different.
 
M

Marshall Barton

rc51wv said:
Is there a control that returns a variable that will let you know if
information in a field on a form that has a table set as it's recordsource
has changed from the table?

Say field PIN has had the number changed from what was there when the form
was loaded, is there a control that will return a true/false answer that I
can use on at close to let me know that the field has changed?

Right now all I have is storing the initial values from the fields on the
form in a global variable and then comparing them on close to see if that
information is different.


Bound controls have the OldValue property that you can use
to do that. The OldValue property will change when the
record is saved so you need to check in the form's
BeforeUpdate or AfterUpdate event, depending on what you
want to do when the value is changed.
 
M

Marshall Barton

Linq said:
Meant to add that I think the Form_AfterUpdate event is too late for this,
because the record has been saved at this point. Think it would have to be
the Form_BeforeUpdate event.


You're right.

I meant an individual control's AfterUpdate event, but I
can't type as fast as I can dictate ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top