Choose from within a Macro

  • Thread starter Thread starter Gerrym
  • Start date Start date
G

Gerrym

I want to be able to ask a Yes or No question, if the
answer is Yes then go on, if no then cancel. How can I do
this from within a macro
 
Use the Condition part of the macro. You can specify the buttons and read
the result by using numbers for the different buttons.

For example, if you want the user to tell you yes or no to "Do you want to
do this?":

Condition: Msgbox("Do you want to do this?", 4, "Confirm Action") = 6

The above will be true if the user clicks the Yes button.
 
Tks Ken
What type of macro can I use this on, when in design view
I choose Action MSGBOX ?

Gerry
 
The action that you use is the one that is to occur if the condition
expression evaluates to True.

The MsgBox will appear as a result of the expression itself; you don't need
another action to make it appear.
 
I have been using Macro Design, so I presume tyour
solution is in VB. I converted my macro to vb and input
your suggestion as indicated below and got a compile error.

' Turn off OK type warnings
DoCmd.SetWarnings False
Beep
Condition: MsgBox("Do you want to do this?",
4, "Confirm Action ") = 6
' If yes goahead
' Delete all records from All Portfolio Permissions
Temp Table
DoCmd.OpenQuery "Delete From Temp", acViewNormal, acAdd
 
No, my solution is for use in a macro, not for use in VBA.

If you don't see a Condition column in your macro design window, then make
it visible by View | Conditions menu.

Then you type the expression that I gave to you in the Conditions column in
the grid of the design view.
 
Thanks again Ken it works fine.

Gerry
-----Original Message-----
The action that you use is the one that is to occur if the condition
expression evaluates to True.

The MsgBox will appear as a result of the expression itself; you don't need
another action to make it appear.
--

Ken Snell
<MS ACCESS MVP>





.
 
Back
Top