run macro

A

Ann

I have a macro that will run a module that writes
password on a table.

I don't want anyone to run it accidently, and overwrites
the password table.

So at the first step of the macro, I use msgbox to
display something like this:
------------------
if you run this macro, it will overwrite password table,
Are you sure you want to run it?
---------------------

But when I choose type is warning for the msgbox, there
is no "yes" or "no" button? So anyway the macro will run
the module and overwrite the password.

Any suggestions?

Thanks
 
K

Ken Snell

The MsgBox action does not let you specify this. But you can use the MsgBox
function as a condition for running a macro step and then you can specify
this.

As a condition, use this:
MsgBox("If you run this macro, it will overwrite password table. Are you
sure you want to run it?", 4, "RUN?") = 6

When the above condition is true, the person has answered yes to the
messagebox.

The Yes/No button combination is assigned a value of 4, OK button is 1,
Yes/No/Cancel button combination is 3; an answer of Yes is 6, No is 7; etc.
 
A

Ann

Thank you, it's very helpful.
-----Original Message-----
The MsgBox action does not let you specify this. But you can use the MsgBox
function as a condition for running a macro step and then you can specify
this.

As a condition, use this:
MsgBox("If you run this macro, it will overwrite password table. Are you
sure you want to run it?", 4, "RUN?") = 6

When the above condition is true, the person has answered yes to the
messagebox.

The Yes/No button combination is assigned a value of 4, OK button is 1,
Yes/No/Cancel button combination is 3; an answer of Yes is 6, No is 7; etc.


--
Ken Snell
<MS ACCESS MVP>



.
 

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