Printing Report (1 Viewer)

Acropolis

Registered User.
Local time
Today, 06:21
Joined
Feb 18, 2013
Messages
182
Hi Guys,

Hopefully someone can help with this, sure it's easy to resolve, just can't quote join the pieces up together.

I have a report which will generate a pick list for the warehouse, can print a single version of it for a specific order absolutely fine.

I have added a button to allow the operator to print all the pick list required for that day, so it needs to open and close the same report multiple times to print them all.

I created the single report first, and it's based on a temp var for the item selected in a list box.

I then thought about the all pick list report, and realised a floor in the way I have designed the report, in that it won't work with multiple items as in printing them on separate pages, it groups them together.

Rather than set to and re-design the report (i HATE creating reports) it would be easier to open and close the report and print each one etc.

I have it working in a fashion, where it opens a form I have created which has a list of the printers available on it, select the printer, it changes the default printer to that and then opens and closes the report and prints, fine no problem, but it won't set the default printer back to what it was, keeps throwing an error.

there must be a neater way of doing it, where the proper print dialog box opens once, select the printer then print everything to that printer.

Any thoughts?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:21
Joined
May 7, 2009
Messages
19,246
Create a Global variable in a Module for your Selected Printer.
Say, you create a Module3

Global DefPrinter As Printer

Now when user selected a Printer (from the function you created), save the Printer

If Module3.DefPrinter Is Nothing Then
Set Module3.DefPrinter = Printers(index of listbox on your form)
End If

Set Me.Printer = Module3.DefPrinter
 

AccessBlaster

Registered User.
Local time
Yesterday, 22:21
Joined
May 22, 2010
Messages
5,993
Many ways of doing this, just my take.



HTH
 

Attachments

  • Print.png
    Print.png
    31.2 KB · Views: 142
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:21
Joined
May 7, 2009
Messages
19,246
Errata,

Since it is not possible to set the Printer On Report Open/Load Event, you can use Access Application Object:

Set Application.Printer = Module3.DefPrint

When you are done with your DB, reset the Printer To Default:

Set Application.Printer = Nothing
 

Acropolis

Registered User.
Local time
Today, 06:21
Joined
Feb 18, 2013
Messages
182
Thanks for the solutions guys, it's appreciated.

Brain is now well and truly frazzled, this working on a Saturday is no good.

It was only meant to be a simple ting to do, but has turned into something more of a pain, so for now it works, and i'm going to leave it at that, and put it on the list of things to revisit at some point in the future and improve when I have more time to think about it.

Have a bucket load of other things that I need to build into the system yet that are more pressing.

Thanks again
 

AccessBlaster

Registered User.
Local time
Yesterday, 22:21
Joined
May 22, 2010
Messages
5,993
No worries, someone will chime in with a solution that will fit your particular issue.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:21
Joined
May 7, 2009
Messages
19,246
Errata,

Since it is not possible to set the Printer On Report Open/Load Event, you can use Access Application Object:

Set Application.Printer = Module3.DefPrint

When you are done with your DB, reset the Printer To Default:

Set Application.Printer = Nothing
 

Users who are viewing this thread

Top Bottom