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

S

Sietske

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?
 
S

Sietske

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?
 
S

Sietske

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top