Opening Print Dialogue before open a report

  • Thread starter Thread starter Mota
  • Start date Start date
M

Mota

Hi;
I want to give the option to print some page of a report to the users and my
ideal solution is to open a print dialogue box just before report opens,and
take its effect on that report.Can it be done programatically?
Thank you in advance for ur help.
 
in message:
Hi;
I want to give the option to print some page of a report to the users and my
ideal solution is to open a print dialogue box just before report opens,and
take its effect on that report.Can it be done programatically?
Thank you in advance for ur help.

There are lots of ways to do this, but this is my personal preference.
Sample code like this:

'********Code Start***********
Private Sub cmdPrintReport_Click()
On Error GoTo ErrorPoint

DoCmd.OpenReport "NameOfReportHere", acPreview
DoCmd.Maximize
DoCmd.RunCommand acCmdFitToWindow
DoCmd.RunCommand acCmdPrint

ExitPoint:
Exit Sub

ErrorPoint:
If Err.Number = 2501 Then
' Ignore
Else
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
End If
Resume ExitPoint

End Sub
'********Code End***********

This will open the report in Preview mode, maximize it, have it
fir the screen, and then pop up the print dialog box for the user
to select their options.
 
Its just what i wanted.Thank you so much.

Jeff Conrad said:
in message:


There are lots of ways to do this, but this is my personal preference.
Sample code like this:

'********Code Start***********
Private Sub cmdPrintReport_Click()
On Error GoTo ErrorPoint

DoCmd.OpenReport "NameOfReportHere", acPreview
DoCmd.Maximize
DoCmd.RunCommand acCmdFitToWindow
DoCmd.RunCommand acCmdPrint

ExitPoint:
Exit Sub

ErrorPoint:
If Err.Number = 2501 Then
' Ignore
Else
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
End If
Resume ExitPoint

End Sub
'********Code End***********

This will open the report in Preview mode, maximize it, have it
fir the screen, and then pop up the print dialog box for the user
to select their options.

--
Jeff Conrad
Access Junkie
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
 
Back
Top