Print from button

a.sinatra

quik
Local time
Today, 12:36
Joined
Jan 10, 2004
Messages
262
Here's what i want:
  • Button on a form named "cmdPrint"
  • When clicked: print a report named "rptRiderSetupAvg" ( i want the dialog for the printer to appear, i dont want the report to open )
________
One Vaporizer
 
Last edited:
Something I've had stored away which will do what you want.....

Print dialogue box

To show the Print dialogue box to allow you to select the printer you wish to print to do the following:


Set the code on the command button to docmd.openreport “ReportName”,acviewprintpreview


Add the following to the "On Activate" event of the report.

Private Sub Report_Activate()
On Error GoTo Err_Report_Activate

If Me.Report.HasData Then
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, Me.Name

Else
MsgBox "There is no data for this report. Canceling report...", vbInformation, " No Data"
DoCmd.Close acReport, Me.Name

End If

Err_Report_Activate:
Resume Next
DoCmd.Close acReport, Me.Name

End sub

.................................................................................................

HTH

Dave
 
Continuing the problem...

All,
This solution certainly helps my case, but I will be printing many documents (up to 100) from a report to pdf, so obviously don't want the dialog opening every time. I need to set the printer to pdf then let the loop run.
Any ideas anyone?
 
There is a post somewhere here which changes the default printer to your selection (PDF I suppose), prints, then changes the default printer back to the original.

Dave
 

Users who are viewing this thread

Back
Top Bottom