Checking for updated records

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

Guest

I have a bound form. Before the form closes I would like to check if any
records have been changed or added. If there have been records changed, then
I need to go update another table. If no records have been changed, then I'd
like to close the form.

I've tried to add code to the On Close event. It seems like it's too late
in the process and no longer sees the form. On Dirty tries to run the code
every time a change is complete... not just once at the end of the process.

My code must not be right too. I've tried On Unload, and it can't recognize
me.Dirty or Form!CSInputs.Dirty. The program crashes and shuts down.

What code should I use and where do I apply it?

Thank you,
Cathy
 
Fist question is, how do you know if any records have been changed or added?

I would try using the form's unload event.
 
I have a bound form. Before the form closes I would like to check if any
records have been changed or added. If there have been records changed, then
I need to go update another table. If no records have been changed, then I'd
like to close the form.

I'd suggest setting a flag in the form's BeforeUpdate event. It fires only if
the user has made a change.

The downside is that the user could have made a "non-change change" - e.g.
changed the value of a field and then changed it back. That's probably
sufficiently unlikely that you needn't worry about it though!

John W. Vinson [MVP]
 
Cathy,
I got a message that there had been a response to my post, but I don't see
it. If you responded, please repost it. Thanks
 
Back
Top