Save Edits? Yes, No, Cancel

  • Thread starter Thread starter Christopher Glaeser
  • Start date Start date
C

Christopher Glaeser

How do I create a form so that closing the form after any edits will prompt
the user to save the edits, discard the edits, or cancel the close?

Best,
Christopher
 
Christopher said:
How do I create a form so that closing the form after any edits will prompt
the user to save the edits, discard the edits, or cancel the close?

Use the Unload event of the form--that can be cancelled.

Inside, write this (air code)

dim cMsg as string
cmsg = "You have unsaved changes. Save them (Yes), " _
"discard (No) or do not close now (Cancel)?"
select case msgbox(cMsg,vbyesnocancel+vbquestion+vbdefaultbutton3)
case vbYes
runcommand accmdsaverecord
case vbNo
me.undo
case vbCancel
Cancel = true
end select
 
Back
Top