Print Report w/o printer window

  • Thread starter Scott_66701 via AccessMonster.com
  • Start date
S

Scott_66701 via AccessMonster.com

I am trying to set up a button to print multiple, different, reports without
the printer screen coming up for each one wanting you to click "OK" to print.
How can I go about fixing this problem.

Example: I have 3 reports named "Report1", "Report2", "Report3". If I click
the "PRINT" button on a form all reports print w/o any windows popping up.

Thanks
 
A

Arvin Meyer [MVP]

From the help files:

DoCmd.PrintOut [printrange][, pagefrom, pageto][, printquality][, copies][,
collatecopies]

The PrintOut method has the following arguments.

Argument Description

printrange One of the following intrinsic constants: acPrintAll, (default)
acSelection
acPages. If you leave this argument blank, the default constant (acPrintAll)
is assumed.

pagefrom A numeric expression that's a valid page number in the active form
or datasheet. This argument is required if you specify acPages for the
printrange argument.

pageto A numeric expression that's a valid page number in the active form
or datasheet. This argument is required if you specify acPages for the
printrange argument.

printquality One of the following intrinsic constants: acDraft, acHigh
(default), acLow, acMedium. If you leave this argument blank, the default
constant (acHigh) is assumed.

copies A numeric expression. If you leave this argument blank, the default
(1) is assumed.

collatecopies Use True (-1) to collate copies and False (0) to print
without collating. If you leave this argument blank, the default (True) is
assumed.
 
A

Al Campagna

Scott,
What Access version? (Shouldn't make a difference though)
What code do you use to print the report?

DoCmd.OpenReport "Report1", acViewPreview
DoCmd.OpenReport "Report2", acViewPreview
opens each report in Print Preview mode... before allowing user to print.

DoCmd.OpenReport "Report1"
DoCmd.OpenReport "Report2"
DoCmd.OpenReport "Report3"
prints the reports immediately, with no preview.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
S

Scott_66701 via AccessMonster.com

Thanks for the replies. I have no idea how you write code into Access. if I
type just what you said into there it doesn't work or do anything for that
matter. What do I need to type before and after this to make it work.

Al said:
Scott,
What Access version? (Shouldn't make a difference though)
What code do you use to print the report?

DoCmd.OpenReport "Report1", acViewPreview
DoCmd.OpenReport "Report2", acViewPreview
opens each report in Print Preview mode... before allowing user to print.

DoCmd.OpenReport "Report1"
DoCmd.OpenReport "Report2"
DoCmd.OpenReport "Report3"
prints the reports immediately, with no preview.
I am trying to set up a button to print multiple, different, reports
without
[quoted text clipped - 7 lines]
 
A

Arvin Meyer [MVP]

Open your form that want to call the printing in Design View, add a command
button and use the On Click event to add an

[Event Procedure]

Then click on the ellipses button (...) at the end of the On Click line and
between the lines:

Private Sub MyButton_Click()

End Sub

add:

DoCmd.OpenReport "Report1"
DoCmd.OpenReport "Report2"
DoCmd.OpenReport "Report3"

so now it should look like:

Private Sub MyButton_Click()
DoCmd.OpenReport "Report1"
DoCmd.OpenReport "Report2"
DoCmd.OpenReport "Report3"
End Sub

When you click the button the reports will print. Make sure you change all
the names above to those in your application.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Scott_66701 via AccessMonster.com said:
Thanks for the replies. I have no idea how you write code into Access.
if I
type just what you said into there it doesn't work or do anything for that
matter. What do I need to type before and after this to make it work.

Al said:
Scott,
What Access version? (Shouldn't make a difference though)
What code do you use to print the report?

DoCmd.OpenReport "Report1", acViewPreview
DoCmd.OpenReport "Report2", acViewPreview
opens each report in Print Preview mode... before allowing user to print.

DoCmd.OpenReport "Report1"
DoCmd.OpenReport "Report2"
DoCmd.OpenReport "Report3"
prints the reports immediately, with no preview.
I am trying to set up a button to print multiple, different, reports
without
[quoted text clipped - 7 lines]
 
A

Al Campagna

Scott,
Let's say you have a button named "MyReports"
In design mode, select the MyReports button.
In the Properties dialog box, find the button's OnClick event.
(in Properties, make sure the ALL tab is selected)
Place your cursor in the blank text control on the right.
Using the little arrow on the right, select Event Procedure from
the drop down.
Click the little button on the right with 3 dots (...)
You are now in the form's Module, where VB code can be placed.
(This code will execute whenever you Click the MyReports button)
You'll see this...

Private Sub MyReports_Click()

End Sub

Enter this between the two lines...

Private Sub MyReports_Click()
DoCmd.OpenReport "YourReportName1"
DoCmd.OpenReport "YourReportName2"
DoCmd.OpenReport "YourReportName3"
End Sub

When you click MyReports, all three reports will print out without
any further interaction.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


Scott_66701 via AccessMonster.com said:
Thanks for the replies. I have no idea how you write code into Access.
if I
type just what you said into there it doesn't work or do anything for that
matter. What do I need to type before and after this to make it work.

Al said:
Scott,
What Access version? (Shouldn't make a difference though)
What code do you use to print the report?

DoCmd.OpenReport "Report1", acViewPreview
DoCmd.OpenReport "Report2", acViewPreview
opens each report in Print Preview mode... before allowing user to print.

DoCmd.OpenReport "Report1"
DoCmd.OpenReport "Report2"
DoCmd.OpenReport "Report3"
prints the reports immediately, with no preview.
I am trying to set up a button to print multiple, different, reports
without
[quoted text clipped - 7 lines]
 
S

Scott_66701 via AccessMonster.com

Thank you for taking the time to explain this. This helps alot and it is
finally working!

Al said:
Scott,
Let's say you have a button named "MyReports"
In design mode, select the MyReports button.
In the Properties dialog box, find the button's OnClick event.
(in Properties, make sure the ALL tab is selected)
Place your cursor in the blank text control on the right.
Using the little arrow on the right, select Event Procedure from
the drop down.
Click the little button on the right with 3 dots (...)
You are now in the form's Module, where VB code can be placed.
(This code will execute whenever you Click the MyReports button)
You'll see this...

Private Sub MyReports_Click()

End Sub

Enter this between the two lines...

Private Sub MyReports_Click()
DoCmd.OpenReport "YourReportName1"
DoCmd.OpenReport "YourReportName2"
DoCmd.OpenReport "YourReportName3"
End Sub

When you click MyReports, all three reports will print out without
any further interaction.
Thanks for the replies. I have no idea how you write code into Access.
if I
[quoted text clipped - 18 lines]
 
S

Scott_66701 via AccessMonster.com

Ok, I thought it was working but it isn't. It just sits there and nothing is
being printed. I typed it in exactly as you said. Does it make a difference
since I'm using Access 2007?

Scott_66701 said:
Thank you for taking the time to explain this. This helps alot and it is
finally working!
Scott,
Let's say you have a button named "MyReports"
[quoted text clipped - 28 lines]
 
A

Al Campagna

Scott,
Please don't delete previous threads. OK to delete (snip) information
that is insignificant, but not the whole pots/s.
We need to see flow of the problem.

Also, when you have a code problem, Cut & Paste (*exactly*) the code
you currently have into your reply.
------------
What happened between those two statements??
--------
Since your code was working.. make sure you didn't change the name of
your button control.
Go to your button's OnClick event.
Does it indicate "Event Procedure"
When you click the (...) does the module open, and display the
code you wrote?
If... all this is as you say, the reports should print when the button
is
clicked.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Scott_66701 via AccessMonster.com said:
Ok, I thought it was working but it isn't. It just sits there and nothing
is
being printed. I typed it in exactly as you said. Does it make a
difference
since I'm using Access 2007?

Scott_66701 said:
Thank you for taking the time to explain this. This helps alot and it is
finally working!
Scott,
Let's say you have a button named "MyReports"
[quoted text clipped - 28 lines]
 

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