Norbert-
That's the error you should be getting unless you have a report open named
"strReport". Do this:
Set rpt = Reports(strReport)
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of
drnorbert@msn.com
Sent: Tuesday, February 26, 2013 6:33 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Run-time error '2451' (Report Name you entered is
mispelled)
In the following code I am getting err 2451 in
line (Set rpt = Reports!strReport)
The following procedure is called by:
PrinterDuplex(strReport)
Where strReport="rptOnlW9DplxEngSpanLtr"
'----------------------------------------------------------
Public Sub PrinterDuplex(strReport)
On Error GoTo PrinterDuplex_Error
Dim rpt As Report
DoCmd.OpenReport strReport, acViewPreview, , , acHidden
Set rpt = Reports!strReport
With rpt.Printer
.Copies = 2
.Duplex = acPRDPVertical 'Double sided
.PaperBin = acPRBNLargeCapacity
End With
DoCmd.OpenReport strReport, acViewNormal
DoCmd.PrintOut , , , acHigh, 1
DoCmd.Close acReport, strReport, acSaveNo
Set Application.Printer = Nothing
On Error GoTo 0
Exit Sub
PrinterDuplex_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
PrinterDuplex of Module ModPublic"
End Sub
'----------------------------------------------------------
[Non-text portions of this message have been removed]
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar