Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code Crashing at Setting a Report Printer

Status
Not open for further replies.

jdgreen

Technical User
Mar 21, 2001
144
US
Below is the code. I get an error message saying the object does not support this property or method where I have the code "Reports(stDocName).Printer = prt". I have used this code elsewhere (on other forms) and it works fine. I am using Access 2003. This code looks at a ComboBox and sets the printer according to what is in the ComboBox. I use it to allow for easier printing to Adobe PDF Writer.

Private Sub Command196_Click()
On Error GoTo Err_Command196_Click
Dim prt As Printer
Dim stDocName As String

stDocName = "repSeniority"
Set prt = Application.Printers(CLng(Me![Printers]))
prt.Orientation = acPRORPortrait
DoCmd.OpenReport stDocName, acPreview
Reports(stDocName).Printer = prt
DoCmd.PrintOut acPrintAll, , , acHigh
DoCmd.Close acReport, stDocName

Exit_Command196_Click:
Exit Sub

Err_Command196_Click:
msgbox Err.Description
Resume Exit_Command196_Click

End Sub

John Green
 
Perhaps this ?
[!]Set [/!]Reports(stDocName).Printer = prt

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Nope, still get the same error. It's a stumper to me because I am using the exact same code on another form in the same database.

John Green
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top