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

  • Follow


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?
0
Reply Utf 1/18/2008 10:59:01 AM

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?


"Sietske" wrote:

> 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?
0
Reply Utf 1/18/2008 12:30:00 PM


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


"Sietske" wrote:

> 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?
0
Reply Utf 1/18/2008 12:52:01 PM

2 Replies
641 Views

(page loaded in 0.042 seconds)

Similiar Articles:













8/1/2012 7:05:14 AM


Reply: