View Full Version : Problems with automatically printing report


randypuppy
04-08-2001, 05:12 AM
In my database I've set up a report and in one of my forms I've got a button which opens and prints the report (using a macro). Is there a way that a Yes/No message box can be displayed before the report is printed - as this would ensure that the report is not accidently printed.

Thanks for your help

Fornatian
04-08-2001, 08:40 AM
Try:
Dim resp as byte
resp = Msgbox("Send direct to printer?",vbYesNoCancel,"Application Title")
'if responded with Yes
If resp = vbYes then
docmd.openreport "Your report",acnormal

'if responded with No
elseif resp = vbNo then
docmd.openreport "Your report",acpreview
end if
'if cancel then do nothing

Should work.

Ian