Printing Reports

  • Thread starter Thread starter Homer OK
  • Start date Start date
H

Homer OK

Guest
Hi
I have a report based on a Query in Access 2000, which prints out several pages when a command button is pressed.

At the moment the print button runs a simple macro which prints all pages without displaying them.

What I would like to do is, before the print action, user to be warned how many pages will be printed and give the option of cancelling print before it's sent to the printer.

Thanks in advance.
 
Hi Homer OK,

perhaps you could calculate the number of pages needed (for exmple if 3 records fill one page => >number-of-records< divided by 3 is no of pages needed). When someone wants to print the results (needed pages) are displayed in a form w/ two buttons "exit" & "print". Both buttons close the form but the "print" prints also.



Hope this helps,

Barbarossa II

PS: I suppose there is some cleverer (and easier) solution (as changing some propierties to cause an already 'built in' window of access to pow up, which asks the for permission to print) but I don't know that one :-(
 
Do you know how to use VBA? Macros are so limited and probably would be difficult to make work in this situation.

I like barbarossaii's idea of counting how many records would fit on a page. Then set this procedure up in the On Click event of the button

Private Sub Button_Click()

Dim intPages As Integer, strMessage As String

intPages=(DCount("[First field of query]","Query Name"))/# of records per page

strMessage="There will be " & intPages & " pages in this report. Do you want to continue?"

If MsgBox(strMessage,VbYesNo)=VbYes Then
DoCmd.OpenReport "Report Name"
End if

Let me know if you've got any questions.
 
Hi there

An alternative solution...

I think we're all agreed that macros are best avoided but if you want to stick with what you already have, in your macro change the View property of your OpenReport call to 'Print Preview'. This will open the report on screen and allow users to step through it using the navigation control and to print required pages using the File|Print menu.

If you want to display the number of pages, put the following line of code in the report's Page event.

MsgBox "This report contains " & Me.Pages & " pages"


hth

shay :cool:
 
Many thanks to all replied. I have not had a change to try out yet but it all looks good.
Many thanks again.
 

Users who are viewing this thread

Back
Top Bottom