Detect Data Changed State in Row with Focus

G

Guest

On a continuous form, how do I detect that the row having focus has had one
or more controls' data changed? A procedure started by a command button
needs to know whether the row with focus has been changed by the user. This
is before the focus leaves the row so the before update event for the row has
not fired. It is after the before update events for a control would fire if
present. Is there a simple way to test the form for the update state of the
row with focus? I want to avoid a lot of VBA to collect the state change for
each control in before update events. I just want to know whether the before
and after update events will fire if the focus leaves the current row.
 
R

Rob Parker

Hi Steve,

The form's Dirty property will tell you this.

It is often used in code to force a record to be saved prior to some other
action about to be done by code (eg. opening a report for the current
record), in this fashion:
If Me.Dirty then Me.Dirty = False
DoCmd.OpenReport ...

Explicitly setting the Dirty property to False will force a record save.
However, you can also just read the property's value. Note also that
setting values of form controls via code does not dirty the form.

HTH,

Rob
 

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