Yes/No Option in Macro

B

Bmistry

I have a maro that runs a number of functions. Before running, I would like
it bring up a MsgBox advising the user what is about to happen and whether
they are sure they want to run and include a YES and NO option.

Right now, the MsgBox function only has the OK button and there is no way of
stopping the macro once it has been started.

Can anyone help?

Thanks
 
J

jl5000

1.Create a form with as many check boxes as macro options you have, label
each check bos to identify the macro line to run

2.In the macro design view show the condition column

3.For each action line type something like this in the condition column:
Forms!MyForm!Check_BoxN (use the name of each check box in your form
corresponding to the action to run)

4.Set the button in your form to call that macro, only the lines in the
macro where the condition is set and is true will execute.
 
A

Al Camp

In your MsgBox, choose vbOKCancel as your button setting.
Example...
Response=MsgBox(Prompt, vbOKCancel, Title)
If Response = vbOK then
' Do Something....
ElseIf Response = vbCancel Then
' Do Something else.....
End If
hth
Al Camp
 
S

Steve Schapel

Bmistry,

Use a MsgBox function in the Condition column of your macro design.
There are numerical constants to define the functionality. For example,
Yes and No buttons has a value of 4. The result of the MsgBox selection
is Yes=6 and No=7. These constants are outlined in Access Help. So,
try your Condition like this...
MsgBox("Are you sure?",4)=6
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top