print report to printer

I have looked at the examples on reporting, and have some reports running… however, all the examples that I have seen have an intermediate step of a printer request dialog… how can I skip this step and have my program print directly to either a printer or file (.pdf) output without going through a requester each time?

Thanks

So, no one know, or there is no way to do this??

Hi Gary,

I can’t remember how to do this right off the top of my head. The good news is there is a way to do it, and it is relatively painless. Give me a couple of days to get back to my home country and I’ll answer your question if no one else has :slight_smile: (It is in my ‘I Wish I Knew How To… Program Access with Xojo in Windows’ book, but I don’t have a copy of it with my right now.)

Sincerely,

Eugene

Instead of OpenPrinterDialog, use OpenPrinter.

Hi Gary,

Alex is correct. Here is some example code with his suggestion:

[code] Dim g as Graphics
Dim ps As New PrinterSetup
ps.MaxHorizontalResolution = -1
ps.MaxVerticalResolution = -1

g = OpenPrinter(ps)

If rs = Nil Then
MsgBox “There is no data in the recordset. Printing Cancelled”
Else
If g <> Nil Then
Dim Rsq as New Reports.RecordSetQuery(rs) 'Put the records into a Reports.DataSet
If rpt.Run( Rsq , ps ) Then 'check to make sure the report runs
rpt.Document.Print(g) 'Print the report
End If
End If
End If[/code]

Sincerely,

Eugene