Save Edits? Yes, No, Cancel

  • Thread starter Christopher Glaeser
  • 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
 
B

Bas Cost Budde

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top