Custom Dialog confirmation box

Danick

Registered User.
Local time
Today, 06:19
Joined
Sep 23, 2008
Messages
371
I have a button on a form that will import data from excel and run an update query. In order to do this without all the warnings, I turn the warning off.
This works fine but I still would like to give the user a chance to back out after clicking the button.

Is there a quick yes/no confirmation dialog box that I can create that will continue or cancel the procedure without having to keep warning on and use the double warnings Access displays when updating a table?
 
Here's my template code for a yes/no message box:

Code:
Dim msg As String, button As Variant, title As String, response As Variant
msg = "Vehicle is Shopped - Do you want to dispatch anyway?"
button = vbYesNo + vbDefaultButton2
title = "Vehicle Shopped!"

response = MsgBox(msg, button, title)
If response = vbYes Then
  'what to do if yes
Else
  'what to do if not
End If
 
Use something like this

Code:
 if MsgBox("Are you sure you want to import data?",vbQuestion+vbYesNo,"Import data?")=vbYes Then
    'your import update code goes here
Else
   Exit Sub
End if

EDIT just noticed pbaldy beat me to it...
 
Thanks all - you guys are amazingly fast!!!
 

Users who are viewing this thread

Back
Top Bottom