Printer dialog box

A

Alex Martinez

Hello,

I need help I am having a hard time on this. I made a menu bar that has a
Print feature when pressed a standard printer dialog box will appear. But
for the life of me I can't print my report it will only print the form..
I created the code in a module :

Public Function ShowPrinter()

DoCmd.RunCommand acCmdPrint

End Function



What am I doing wrong? In the past it worked Any tips will be appreciated.
Thank you in advance.
 
A

Allen Browne

To open the report, use the OpenReport action instead of the print dialog.
 
A

Albert D.Kallal

any chance you have a form with a timer function?

This is a known probem....


The select object command is needed to fix a "focus" bug if you have a form
with a timer function.

For the code that pops up the printer dialog (so the user can change
printers etc).

You can use:


On Error Resume Next
DoCmd.SelectObject acReport, Screen.ActiveReport.Name
DoCmd.RunCommand acCmdPrint

The select object command is needed to fix a "focus" bug if you have a form
with a timer function.

The code to print right to the printer while in preview mode without any
prompts can be:

On Error Resume Next
Dim strReportName as string
strREportName = Screen.ActiveReport.Name
DoCmd.SelectObject acReport, strReportName
DoCmd.PrintOut acPrintAll

So, I useally have a custom menu bar with both of the above buttions on
it.....
 

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