Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2003-12-08
3
Medium Priority
?
359 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 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

604 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