I have an application that needs to print ID Cards on a PVC card printer with all margins set at .01", Landscape, and a paper size of "CR-80".
I am constantly making minor changes to the FRONTEND file and sending it out to all the sites, and I have to remember to change the SPECIFIC PRINTER in the PAGE SETUP of each REPORT that prints an ID CARD.
Some sites have a FARGO DTC1250e, some have a MAGICARD(p), etc... they are rarely named consistently even if they are the same model printer.
I use a table that holds various parameters for the application, and have set the exact printer name for each site's card printer.
The challenge is, that if ACCESS ever tries to print one of those reports, and for what ever reason it can't see the right printer, then it pops up the screen that says "THIS REPORT WAS ORIGINALLY FORMATTED FOR .....",
depending on what the user does at that point, things can go horribly wrong.
Is it possible to set (in VBA) the papersize, margins, orientation each time a report prints.
Or is there another method that would be a better option.
Below is what I'm currently doing to grab the right printer. It works ok, unless there was a hiccup and someone tried to print the same report to a different printer. then it seems like the orientation/margin/etc... settings are lost.
'<<<<<<<Begin Print Routine.............
'Get the name of the desired printer, and the DEFAULT printer in case there's a problem
Dim stReportPrinter As String
Dim stPrinterDefault As String
stPrinterDefault = Application.Printer.DeviceName
'Set the printer to use for this report
stReportPrinter = Nz(DLookup("[FieldValue]", "tblParameters", "[FieldName] = 'PrinterPVC'"), stPrinterDefault)
Set Application.Printer = Application.Printers(stReportPrinter)
Dim stReport As String
stReport = "rptCashCardPVC_1Up"
DoCmd.OpenReport stReport, acViewNormal
Set Application.Printer = Nothing
'...........>>>>>>>>>>End Print Routine