Hi Peter
QUOTE
(from the code Archive)
For continuity's sake I'll ask this here. I'm not clear where/when this setup form is called. Would it be behind the command button that prints the report?
I'll answer this here as the code archive is not really the place for technical discussion.
In my dbs I have a command on the ribbon (or a menu bar for A2003) that will open up the printer defaults set up form.
When the db is first installed then the user (or an administrator) can set up which printer s/he wants each report type to go to - you can have as many different report types as there are reports if you so wish, but normally I have 2 'standard' report types (A4 Landscape and A4 Portrait) to which "all" standard reports are sent to. Additionally there will be report types for reports that go to e.g. a thermal printer, or a bar code printer etc You also may have report types that you want sent to other specific printers or with specific formats. But once set up the PrinterSelectPrinter function will interrogate the 'tblPrntDflts' table and will set up the report with all the defaults defined on the setup table for that report type.
So you would print or preview a report completely independently of the setup.
However To print or preview a report; instead of (e.g.)
DoCmd.OpenReport "ReportName", acViewPreview, , stLinkcriteria, acNormal, strArgsYou would replace this with:
PrintSelectPrinter "ReportName", acViewPreview, stLinkcriteria, [ReportType], strArgsWhere [ReportType] is the ID of the record in table 'tblPrntDflts' which is the report type to be used for the selected report.
Hope that helps
Edit:
Where you have 6 printers then you would need at least 6 report types set up in the database, if some are these are both landscape and portrait you will need an additional report type for each printer that uses both landscape and portrait formats.