Selasa, 24 Februari 2015

[MS_AccessPros] Re: SetUp Printer Settings in a Report via VBA MS Access 2013

 

Bill,


Great suggestion!


Thanks a lot I am working with this as of  now.


In this application there are 250 reports and the reports are created at night (EOD end of day procedure)


I think it will be a good idea to check if the printer is the correct before the function is executed.


If each report has to be open every time it may take much longer time the EOD.


How do I check if the printer has the correct printer before I can open the report and change it to the correct printer?


Regards,

Norbert


I added the parameter to call the function:


Public Function CheckRptPrinter(RptName as string)
'Purpose  : Check all reports to see if printer is set correctly.
    Dim rpt As Report
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim strSQL As String
    Dim strPrinter As String
    
    Set db = CurrentDb
    strSQL = "SELECT RptName, PrinterName FROM tblRptPrinters"
    Set rs = db.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
    
    With rs
        Do While Not .EOF
            DoCmd.OpenReport !RptName, acViewDesign
            Set rpt = Reports(!RptName)
            strPrinter = !PrinterName
            rpt.Printer = Application.Printers(strPrinter)
            Set rpt = Nothing
            'Save and close report.
            DoCmd.Close acReport, !RptName, acSaveYes
            
            .MoveNext
        Loop
    End With

    Set rs = Nothing
    Set db = Nothing

    MsgBox "Report printer setup complete.", vbInformation

End Function

__._,_.___

Posted by: drnorbert@msn.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

.

__,_._,___

Tidak ada komentar:

Posting Komentar