Newbie - Exit w/o update

  • Thread starter Thread starter Bumbino
  • Start date Start date
B

Bumbino

I have a new database and I want to give the user a chance to exit the form
without the info they have entered into the controls being added to the
table. There are 5 controls but when they select the exit button, anything
that they have entered still gets saved to the table. This happens even if
they have only entered text into 1 control. Any help would be appreciated.
 
A record in a form will be updated whenever you move to a different record or
close the form. You can control that in click event of your exit button by
asking the user if the want to save the record:

If Me.Dirty Then 'There is changed or new data in the record
If MsgBox("Save This Record", vbQuestion + vbYesNo) = vbYes Then
Me.Dirty = False 'Saves the record
Else
Me.Undo 'Destroys the record
End If
End If
 
Back
Top