Error when trying to print to pdf using pdf printer on network

Error when trying to print to pdf using pdf printer on network

Post by U2lldHNrZ » Sat, 19 Jan 2008 19:59:01


myHi all!

I already read a lot of earlier questions on this subject, but the answers
just didn't seem to help in my case. I hope one of you can help me out:

Several persons will have access to my database. When they have added the
network pdf printer (called "PDFCreator") they should be able to print single
records as pdf documents. However, the button I've added to make this
possible, does not work. Literally, it contains the following code:

'****************************

Private Sub btnPrintAlsPDF_Click()
On Error GoTo Err_btnPrintAlsPDF_Click

Dim strDocName As String
Dim strWhere As String
strDocName = "rptMyReport"
strWhere = "[Id_Record]=" & Me!Id_Record
DoCmd.OpenReport strDocName, acViewPreview, , strWhere
Application.Reports(strDocName).Printer =
Application.Printers("PDFCreator")

Exit_btnPrintAlsPDF_Click:
Exit Sub

Err_btnPrintAlsPDF_Click:
MsgBox Err.Description
Resume Exit_btnPrintAlsPDF_Click

End Sub

'****************************

The error occurs in the part Application.Printers("PDFCreator"). It says
"Ongeldige procedure-aanroep of ongeldig argument", which means something
like "invalid call for the procedure, or invalid argument".

Can somebody please tell me what is needed to fix this problem?
 
 
 

Error when trying to print to pdf using pdf printer on network

Post by U2lldHNrZ » Sat, 19 Jan 2008 21:30:00

I've solved one part of the problem: the name of the PDF printer was
incomplete. Now this is solved, the error message has gone. But still there
is no pdf created! What can be wrong?

 
 
 

Error when trying to print to pdf using pdf printer on network

Post by U2lldHNrZ » Sat, 19 Jan 2008 21:52:01

The other problem is solved too, now.
I simply replaced

Application.Reports(strDocName).Printer =
Application.Printers("NameOfMyNetworkPrinter")

with

Application.Reports(strDocName).Printer = Printers("NameOfMyNetworkPrinter")

Now it works great, thanks to the website of Helen Feddema.

Bye!
Sietske