report printing, want only 1st page

scott51

New member
Local time
Today, 09:36
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?
 
Have you tried in your macro print code instead of say:
DoCmd.printout
Replace with
DoCmd.printout acPages, 1, 1
 
Can't, it will give "invalid code".
Figure if there is a code for this it would be VBA.
 
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.
 
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.
 
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.
 
Must have missed that - stupid me. Odd it wouldn't even let me type it in, just kept saying invalid code. Thank you both.
 
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

Back
Top Bottom