oPTION Group Coding

M

Maran

I have a macro, which will print all reports. I have a button in a option
group assigned to this macro, which will print 10 reports. ( The other
buttons, in the option group will print individual reports). I want to
restrict user , because, sometimes, he may click it , when he does not want
to print all reports.

I want to know, how to give a message box, in an option group, a yes or no
message box to restrict from printing. If he clicks yes, it should run the
macro, if he click no, it should not print and come out.

Please help..
 
A

Allen Browne

In macro design view, show the Conditions column (if it's not already
showing.)

In the Condition column enter something like this:
MsgBox("Really Print?", 4, "Confirm" ) = 7

In the Action column beside this, choose StopMacro.

That should stop the macro if the user choose No in the diaolog.
 
M

Maran

Thanks a lot. Simple and effective

Allen Browne said:
In macro design view, show the Conditions column (if it's not already
showing.)

In the Condition column enter something like this:
MsgBox("Really Print?", 4, "Confirm" ) = 7

In the Action column beside this, choose StopMacro.

That should stop the macro if the user choose No in the diaolog.
 
M

Maran

Thanks. I used the same macro, which will restict user from opening a form.
But, if fails. Can you please help

Condition Action
MsgBox("Really Print?",4,"Confirm")=1 stopmacro
[meetings]=1 (Option group name) openform

Even if, I click, no, it opens up the form. I do not want to open the form,
if the user clicks no on the message box.
 
M

Maran

I do not know, why . Even if the user choses, yes, the macro gets stopped.

Please help
 
D

Douglas J. Steele

Look again at what Allen said. When you're using a value of 4 in the MsgBox
function, that means that the buttons that appear are Yes or No (4 is the
value of the vbYesNo constant). Your code is checking to see whether they've
clicked on the OK button (1, or vbOK), so it's not going to do anything. You
need to check if they've clicked on the No button (7, or vbNo), or the Yes
button (6, or vbYes)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Maran said:
Thanks. I used the same macro, which will restict user from opening a
form.
But, if fails. Can you please help

Condition Action
MsgBox("Really Print?",4,"Confirm")=1 stopmacro
[meetings]=1 (Option group name) openform

Even if, I click, no, it opens up the form. I do not want to open the
form,
if the user clicks no on the message box.

Allen Browne said:
In macro design view, show the Conditions column (if it's not already
showing.)

In the Condition column enter something like this:
MsgBox("Really Print?", 4, "Confirm" ) = 7

In the Action column beside this, choose StopMacro.

That should stop the macro if the user choose No in the diaolog.
 

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