Code to send report directly to printer (or bring up printer dialogue box)?

N

Nimrod

I'm working on a database, and wish to make it "Idiot-Proof". I have
the Access window hidden, and only a switchboard showing. When I
click on the View/Edit button the switchboard hides, and the database
form shows. Clicking Exit closes that form and brings my switchboard
back.

The problem I'm having now is the report printing. When I click
"Generate Report", I have to show the Access Window, which then
presents a "Report Preview".

Is there any VB code, or Macro I can use that will send a specified
report directly to the printer, avoiding this preview?

Thanks in advance,
Scott
 
N

Nikos Yannacopoulos

Nimrod,

Through VB, you can choose whether to preview or print a report upon
opening it, by means of one of the arguments:

DoCmd.OpenReport "MyReport", acViewNormal

will rpint it right away, while:

DoCmd.OpenReport "MyReport", acViewPreview

will open it in preview.

IMHO giving the user just the print option is not always a good idea; I
always *make* them open in preview first, so if they have made a mistake
in parameters selection they know before they send a few hundred pages
to the printer, which they didn't need in the irst place! You could use
two separate buttons on your switchboard, or ar preview one only,
following which they have to use the mouse right-click to print, or a
pop-up form with a print and a cancel button or...

HTH,
Nikos
 
M

msnews.microsoft.com

Nikos Yannacopoulos said:
Nimrod,

Through VB, you can choose whether to preview or print a report upon
opening it, by means of one of the arguments:

DoCmd.OpenReport "MyReport", acViewNormal

will rpint it right away, while:

DoCmd.OpenReport "MyReport", acViewPreview

will open it in preview.

Thank you for the pointers. Is there a way, either via macro, vb, or report
properties to have the report opened maximized when using acViewPreview? I
think this is the best way to go. The otherway tends to send the report to
the printer without bringing up the dialogue box.

Again, thank you for your time and assistance.
Scott
 
C

Chris Reveille

After the following line:
DoCmd.OpenReport stDocName, acPreview
Insert
DoCmd.Maximize
DoCmd.RunCommand acCmdFitToWindow

Chris
 

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