| re: close form macro
Hi again Mindy,
Access automatically updates and adds data when closing a form. In
order to trap a response from your users you might like to add a bit of
VBA code in the Before Update event section on the form you want to
check. Remember however, that providing prompts to users is a very
useful aspect of UI design, however repetitious prompting can make an
otherwise nice db quite tedious to use (personal thoughts...). You
might simply inform your users that if they don't wish to update the
form's data that they can use the ESC key twice to clear the current
form's data and then close.
If you do want to provide promts something like should do what you
want.
If MsgBox("Do you want to save this record?", vbQuestion + vbYesNo,
"Save") = vbYes Then
DoCmd.Close
Else
MsgBox "If you want to cancel saving this form press the ESC key twice
and then close again.", vbInformation + vbOKOnly, "Information"
DoCmd.CancelEvent
End If |