Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Multiple Pages of a Report 2

Status
Not open for further replies.

perrymans

IS-IT--Management
Nov 27, 2001
1,340
US
If I have a blank report, that I want printed X number of times, how can this be done?

Basically, I am going to have some reports. But to allow the user to fill out info first, I want a blank printed version. But they may need anywhere from 1 to 300 sheets. How can I give them the option of printing X number of sheets?

Thanks. Sean.
 
crude hack: make a 'tblCounting' that has a single field, that counts from 1 to ... let's say 10000.

Now in a form, prompt the user for how many 'copies' they want. Set the report's datasource to this 'tblCounting', and put as the filter "where [NUMBER] < " & txtNumPages


Or, you can educate them to use the Print Options dialog box, found via File->Print, or CTRL-P. I prefer this option, as this helps them with any office product, and it even speeds up the printing.

As for filling the report with blank data: make a copy of the report, name it rptReportNameBLANKDATA. Make all the textboxes unbound, remove the data source, or set it to something with only one row, or set it to "tblcounting" like I suggested above. Then have them open the BLANKDATA report if they want it blank, if not, use the regular report.
 
DoCmd.PrintOut acPages, firstpage#, lastpage#, , numberofcopies

From the help files:
PrintOut Method
See Also Applies To Example Specifics
The PrintOut method carries out the PrintOut action in Visual Basic.

expression.PrintOut(PrintRange, PageFrom, PageTo, PrintQuality, Copies, CollateCopies)

expression Required. An expression that returns one of the objects in the Applies To list.

PrintRange Optional AcPrintRange.

AcPrintRange can be one of these AcPrintRange constants.
acPages
acPrintAll default
acSelection
If you leave this argument blank, the default constant (acPrintAll) is assumed.


PageFrom Optional Variant. 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 Optional Variant. 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 Optional AcPrintQuality.

AcPrintQuality can be one of these AcPrintQuality constants.
acDraft
acHigh default
acLow
acMedium
If you leave this argument blank, the default constant (acHigh) is assumed.


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

CollateCopies Optional Variant. Use True (–1) to collate copies and False (0) to print without collating. If you leave this argument blank, the default (True) is assumed.

Remarks
For more information on how the action and its arguments work, see the action topic.

You can leave an optional argument blank in the middle of the syntax, but you must include the argument's comma. If you leave one or more trailing arguments blank, don't use a comma following the last argument you specify.

Example
The following example prints two collated copies of the first four pages of the active form or datasheet:

DoCmd.PrintOut acPages, 1, 4, , 2


=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top