Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to add a "Confirm Changes?" message prompt to a form before saving the record?

Posted on 2003-12-08
3
334 Views
Last Modified: 2012-06-27
I have a record entry form for users to fill in.  I have added a confirmation prompt to confirm that their record has been saved, but I now would like to initially prompt the user to ensure they are happy with their finished record before committing to saving it.

I ideally want a msgbox prompter to offer the options:

1. YES - Saves the record and resets (blanks) the form fields, then gives the confirmation prompt.
2. NO - Reverts the user back to the form WITHOUT SAVING, allowing the User to make other edits to the unsaved record before trying to save again.
0
Comment
Question by:Lukasx
3 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 125 total points
ID: 9895447
If you are either just moving from one record to another or closing the form to force a save then you can use the Form_Beforeupdate event procedure to control the save.

The beforeupdate event has a Cancel option.  If you set this to true the save is cancelled.

Private Sub Form_beforeupdate(Cancel As Integer)
Dim resp
resp = MsgBox("Do you wish to Save the record?", vbYesNo + vbQuestion, "Save Changes")
If resp = vbYes Then
' do nothing
Else
Cancel = True  ' cancels the update
End If

End Sub

However if you are using a Save button then you just bypass the saverecord statement if the user says no.

Pete


0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 9895448
try putting this behind a button:

If MsgBox("Are you happy with this?", vbYesNo) = vbYes Then
DoCmd.RunCommand acCmdRecordsGoToNew
End If
0
 

Author Comment

by:Lukasx
ID: 9895585
Thanks to both of you for your prompt responses!

I have chosen peter57r's solution because it caters not only for the button, but also allows for closing the form and other 'update' events.

Cheers,

Luke
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question