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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigate form without Saving 1

Status
Not open for further replies.

sham14

MIS
May 14, 2003
42
NL
Does anyone know the best way to do the following. I am opening a form in edit mode and i want the user to be allowed to navigate and then make changes where appropriate. At the moment i have 4 buttons. As Follows:
1. Button to Save - I have attached validation code to this so that information must be validated before saving.
2. Next Record - to navigate to next record.
3. Previous Record - to navigate to previous record.
4. Close button - this button closes form with parameter acSaveNo so no changes will be saved unless save button is pressed.

My problem is this - i can make changes on the form and click on either next record or previous record and the record is automatically saved. Do you know how i could stop this?

Thanking you in advance.
 
The BeforeUpdate() event can be cancelled, thus "cancelling" the save.

The Me.Undo command will undo all changes if any have been made to the record.


What you need is something that marks some sort of "allowSave" variable to True when you click on the save button. If the save fails, mark the allowSave variable back to false.

In the BeforeUpdate() event, if the allowSave = True, then continue, otherwise cancel the event.




This will work.

--
Find common answers using Google Groups:

Corrupt MDBs FAQ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top