How to present user with Yes/No option to continue/cancel macro

johnb19

New member
Local time
Today, 10:24
Joined
Aug 23, 2013
Messages
9
My year-end macro consists of several clear and rebuild tables. How do I present a "Do you want to continue?" Yes/No message and Cancel the whole macro if No is selected.
 
This was moderated, not sure why. In VBA you'd use a message box with the Yes/No options, test for the button selected and move on. I don't use macros so not sure how it would work in one, but it would probably involve the condition option. If you are using VBA, this is from my template:

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
 
Sorry, I should have mentioned I am using Access 2002 and not familiar with VB. When I open Macros in Design View, the display shows Command and Comments...would like the first Command to present the Yes/No condition and then End the macro if No is selected.
It goes without saying, I a rookie. Thanks for your help.
 

Users who are viewing this thread

Back
Top Bottom