Print copies of report with different footer

maabbas

Board Regular
Joined
Aug 11, 2011
Messages
201
Hello everyone,

I am using the following code to print my BOL report from command button on data entry form, with different footer, the code is working fine but printing all the pages 3 times , I want to know how i print the current page
Code is below

Thanks

Private Sub Command213_Click()



Dim x As Integer 'loop counter

For x = 1 To 3
Me.Painting = False
DoCmd.OpenReport "tblbolreport", acViewPreview
If x = 1 Then
Reports!tblbolreport!txtReportTitle.Value = "Customer Copy"
ElseIf x = 2 Then
Reports!tblbolreport!txtReportTitle.Value = "Seller Copy"
ElseIf x = 3 Then
Reports!tblbolreport!txtReportTitle.Value = "Office Copy"
Else
Exit Sub
End If
DoCmd.OpenReport "tblbolreport", acViewNormal
DoEvents
Me.Painting = True
Next x


End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
hi maabbas, please use code tags around your code to keep the formatting of your code correctly and make it easier to read (see example in red below)

the macro you provide does not do the printing, it only sets the report title and then calls a macro OpenReport in a module called DoCmd, which I assume then does the printing. If you can show the code in that macro I can have a look at it.
 
Upvote 0
I don't see any options for the OpenReport method to set page numbers. So no luck there. Perhaps you can write a separate report for just the information you want to show without the extra detail.

@sijpie, the DoCmd object in Access is an inbuilt system library that provides access to various MSAccess features, you can't view that source code or change it.
 
Upvote 0
Ah, fooled again by thinking this was an excel thread...
 
Upvote 0
You have to open, set the title, print, close, loop, repeat. Your code has some redundancy as well, so if you need help to continue, read on.
Do you want the report to print automatically or let the user do it? If user, you cannot pause code while they take whatever time to look at it, so be prepared to print out each report with the setting you want without intervention. This means if it's 150 pages, that's what you'll get unless you put a limit on how many you'd accept.
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,242
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top