Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No Automatic Saving

Status
Not open for further replies.

chipdavis

Programmer
Feb 1, 2005
8
US
Is there a way to prevent Access from automatically saving a record on a form when the user moves to the next record? Could a save prompt appear instead (Save? YES or NO)?

Our users occasionally mistype in a field and don't want to save the record. Instead, they would like to move on to the next record and NOT save the previous record (they would like the "previous" record to revert to the old data before they mistyped). Is this possible?

Thanks!

Chip
 
in the form before update enter this code
cancel= not me.activecontrol.name="btnSave"


 
There are a couple of ways to approach this. One way is to use unbound forms and require users to perform some step to save the record (click a button or whatever). But, in your case, I think your form is already constructed as a bound form. So, a different approach would be easier.

When fields in a bound form are changed, the form becomes "dirty". At this stage, if the form is closed or if one attempts to move off that record, the form's BeforeUpdate event fires. This event can be cancelled, effectively cancelling the update. Look up BeforeUpdate in Access Help. If the update is cancelled, the form remains as it was. So, to revert back to the original data, you must "undo" the form (me!undo).

To take advantage of this you could include in the form's BeforeUpdate evernt, a procedure which pops a msgbox giving the user a choice to save, not save, or cancel and perhaps re-edit. To save, nothing further would be done to the form in this event. To not save, the form would be "undone" but still allow moving on. To cancel, the process would stop and display the form in its "dirty" status.

This process should work even if the user clicks the 'x' or otherwise attempts to close Access.
 
Also RoyVidar's faq702-5010 is worth to check in connection with MolLaker's post

________________________________________
Zameer Abdulla
Visit Me
The best thing to spend on your child is your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top