Confirm Record Changes

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

In the tools/options I have "confirm record changes"
checked. I was assuming that this meant before I move to
a new record or close database it would ask me if I want
to save the record but it doesn't. However - I would like
it to! Basically I don't know much about any code type of
things in access, just basic stuff. Can someone help me
to get it to ask to save before closing? Thanks!
 
Aaron said:
In the tools/options I have "confirm record changes"
checked. I was assuming that this meant before I move to
a new record or close database it would ask me if I want
to save the record but it doesn't. However - I would like
it to! Basically I don't know much about any code type of
things in access, just basic stuff. Can someone help me
to get it to ask to save before closing? Thanks!

I accomplish this by adding a check to see if anything is
changed on the form before updating the record by code on the
Before_Update event. The scenerio is, check each control
against the controls "OldValue" property, and if any value
has changed, pop up a message box asking if you want to
save. I use a Yes/No message box. If they click No, then
execute an Undo command, which will restore the record to
it's previous value an it will therefore not be saved. If
they click yes, then just let it proceed normally and the new
values will be saved.

gm
 
Actually, you don't need to check the Controls' Values against the
corresponding OldValues. Something must have been changed (i.e. the Form is
dirtied and there are change(s) to be saved) for the BeforeUpdate Event to
occur.

If nothing has been changed (i.e. no need to save), the Form_BeforeUpdate
Event doesn't fire.
 
Back
Top