A confirmation box to print a large report

Greetings,

I have a macro that prints 6 separate reports.  I thought I could simply add a msgBox before the print lines in the macro that says "This will print 5 reports . . . bla bla. Are you sure you want to continue" with the option to continue the macro or cancel.

But any of the message types do not automatically  allow this continue or cancel like I thought it might, so how do I accomplish this within the macro?

Thanks
LVL 2
MixmangleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Assuming you're doing this with a button, then put this in the Click event of that button:

If Msgbox("Are you sure you want to continue?", vbYesNo, "Confirm Print") <> vbNo Then
  Exit Sub
End If

Docmd.OpenReport "Report1", acViewPreview
doCmd.OpenReport "Report2", acViewPreview
etc etc
0
TWBitCommented:
To do this solely in a macro, turn on macro conditionals (View|Conditions)

As the first line of the macro, in the Conditions column, enter

MsgBox("Do you want to print all the reports?",4)=7

and next to it, in the Action column, put StopMacro.


But it's better to do this stuff in code - much more flexible,

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dqmqCommented:
In macro designer, click on the View menu to open up the conditions column.  Add a line before printing the first report and put this in the conditions column:

MsgBox("Do you want to continue?",1)<>1

In the action column, put StopMacro.

Now, when that line is encountered, the Msgbox will pop up and the macro will stop, depending on how it is answered.  You can play around with different buttons and return values from the msgbox function, but I think you get the idea.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

dqmqCommented:
Oh well, a little late...
0
TWBitCommented:
:)  Here is a link to all the message box types and return values: http://msdn2.microsoft.com/en-us/library/aa445082.aspx
0
MixmangleAuthor Commented:
Bingo.  I was unaware of the Macro Conditions View.  I knew it could be done within the macro, but wasn't seeing it!  Your link to all the number types really helped too!
0
TWBitCommented:
Great, glad it works for you.  Let us know when you switch to coding instead of macros - we're here to help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.