report printing, want only 1st page (1 Viewer)

scott51

New member
Local time
Today, 11:07
Joined
Jun 22, 2012
Messages
9
Have a macro set up in a form to print a filtered report where it shows a particular invoice. (Access 2010).

where condition is [Invoicenumber]=[Forms]![Invoice form].[invoicenumber]

then run menu command of PrintObject

That works except when the customer has 2 or more models and then it wants to print a page per model. There is a list box to choose the model for the invoice on the form. At present only way to do it is to change the print box to print page 1 of 1 every time you print which happens a lot. Is there a code to keep this from happening, or even just automatically select 1 of 1 for the print?
 

AlexTeslin

Registered User.
Local time
Today, 08:07
Joined
Jul 10, 2008
Messages
55
Have you tried in your macro print code instead of say:
DoCmd.printout
Replace with
DoCmd.printout acPages, 1, 1
 

scott51

New member
Local time
Today, 11:07
Joined
Jun 22, 2012
Messages
9
Can't, it will give "invalid code".
Figure if there is a code for this it would be VBA.
 

vbaInet

AWF VIP
Local time
Today, 16:07
Joined
Jan 22, 2010
Messages
26,374
So why not use VBA code instead?

By the way, there's a PrintOut action in Macros. But remember to select the object (using SelectObject) before printing.
 

scott51

New member
Local time
Today, 11:07
Joined
Jun 22, 2012
Messages
9
So why not use VBA code instead?
Would if i knew the VBA code to accomplish this.

By the way, there's a PrintOut action in Macros. But remember to select the object (using SelectObject) before printing.
There is no PrintOut action in Macros in Access 2010. The where condition filters to a single invoice. Maybe if I could add another where condition the the open report statement to filter to a single model, but don't see how to do this.
 

vbaInet

AWF VIP
Local time
Today, 16:07
Joined
Jan 22, 2010
Messages
26,374
Alex gave you a snippet of the code you need. Did you manage to give it a try?

If you click the "Show All Actions" button on the ribbon, then expand System Commands you should find the PrintOut command there.
 

scott51

New member
Local time
Today, 11:07
Joined
Jun 22, 2012
Messages
9
Must have missed that - stupid me. Odd it wouldn't even let me type it in, just kept saying invalid code. Thank you both.
 

vbaInet

AWF VIP
Local time
Today, 16:07
Joined
Jan 22, 2010
Messages
26,374
I'm not entirely sure why those actions are hidden because I've not yet played with Access 2010 but I suspect that MS believes they can pose security threats or they will soon be deprecated.
 

Users who are viewing this thread

Top Bottom