Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save or Discard Record

Status
Not open for further replies.

ianbar

Technical User
Jan 10, 2003
69
GB
Hi,

Could someone show me some example code I could use to prompt the user to save or disgard the information entered into the form, when they exit the form?

Thanks.
 
something like this ?

Dim Msg, Style, Title, Response, MyString

Msg = " Are you sure you want to Save this Record ?"
Style = vbYesNo + vbInformation + vbDefaultButton2
Title = "Save Record ?"
Response = MsgBox(Msg, Style, Title)

If Response = vbYes Then
MyString = "Yes"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
MsgBox "The Record has been saved to the database", vbOKOnly, "Record Saved"


Else
MyString = "No"
End If
 
Thank you for your reply. Does that could exit the form without saving the data?
 
yes, you close do


Else
My String = "No"
docmd.close
end if

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top