How to present user with Yes/No option to continue/cancel macro (1 Viewer)

johnb19

New member
Local time
Today, 07:30
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.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:30
Joined
Aug 30, 2003
Messages
36,131
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
 

johnb19

New member
Local time
Today, 07:30
Joined
Aug 23, 2013
Messages
9
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.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 15:30
Joined
Jul 9, 2003
Messages
16,269
Sorry, I should have mentioned I am
Due to a bug in the forum software this message was "unapproved" (hidden) for some considerable time. I have just approved it. I hope no one has been inconvenience too much! The new forum software no longer has this bug, so this problem should not reoccur.
 

Users who are viewing this thread

Top Bottom