Handling Unload Event

ramhanuman

Registered User.
Local time
Today, 03:47
Joined
May 1, 2012
Messages
13
Lets say the user enters some information into the textboxes in the form window but decides to scrap it so he/she clicks the X button. I know I should handle this in the form unload event but I don't know how to prevent the form from saving to the database. This is what I thought the code should look like:

Private Sub Form_Unload(Cancel As Integer)
Me.Undo
End Sub

Any ideas on how to prevent the form from saving to the tables if the user clicks the X? Thank you
 
it is to late to stop the save at that point

the behaviour of access is to try and save whenever it can, basically

----
what you could do is this

in the forms before update event put something like this

Code:
if me.dirty then
   if msgbox("please confirm you wish to save your changes",vbyesno)= vbno then
       docmd.undo
   end if
end if
 

Users who are viewing this thread

Back
Top Bottom