Solved

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

Posted on 2003-12-08
3
347 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
[X]
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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

728 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