Print to PDF Not Working (1 Viewer)

Reese

Registered User.
Local time
Today, 13:01
Joined
Jan 13, 2013
Messages
387
I have a database that has several reports that we print to PDF using Window's 10 "Print to PDF" printer. Starting yesterday, for some reason, it won't work. Access just says "Microsoft Access couldn't print your object". I did make some changes to the database yesterday, but they were to a specific set of reports. This error seems to be database-wide. No matter what report I try to print to PDF, it comes up with the same error.

I tried printing to PDF in another application--Microsoft Word--and it works fine. I also tried Compact/Repair both the front end and back end and that hasn't helped.

Does anyone have any suggestions?
 

Ranman256

Well-known member
Local time
Today, 13:01
Joined
Apr 9, 2015
Messages
4,339
have you tried:
docmd.OutputTo acOutputReport ,"rMyReport",acformatpdf,"c:\temp\MyReport.pdf"
 

Reese

Registered User.
Local time
Today, 13:01
Joined
Jan 13, 2013
Messages
387
have you tried:
docmd.OutputTo acOutputReport ,"rMyReport",acformatpdf,"c:\temp\MyReport.pdf"

I tried that with the following specific code and got a run-time error '2498'.

Code:
DoCmd.OutputTo acOutputReport, "ZooMobile Billing Invoice Digital", acFormatPDF, "C:\Users\Education\Desktop\Scrap", "[Event_ID]=" & Me.InvoiceTxt

The "[Event_ID]=" & Me.InvoiceTxt is vital, because that specifies which record gets printed.

Also, even if I do get it to work, it doesn't solve the problem completely. It will only work with command buttons in forms. What if I open a report normally, then want to print it to a PDF (which I do want to be able to do)? This still won't solve that issue.
 

Reese

Registered User.
Local time
Today, 13:01
Joined
Jan 13, 2013
Messages
387
Oh, and I tried printing to PDF on another computer, with a different copy of the front end database that I hadn't updated with the slight changes that I made yesterday. The Windows Print to PDF still works fine on that one.
 

isladogs

MVP / VIP
Local time
Today, 17:01
Joined
Jan 14, 2017
Messages
18,186
I tried that with the following specific code and got a run-time error '2498'.

Code:
DoCmd.OutputTo acOutputReport, "ZooMobile Billing Invoice Digital", acFormatPDF, "C:\Users\Education\Desktop\Scrap", "[Event_ID]=" & Me.InvoiceTxt

The "[Event_ID]=" & Me.InvoiceTxt is vital, because that specifies which record gets printed.

Also, even if I do get it to work, it doesn't solve the problem completely. It will only work with command buttons in forms. What if I open a report normally, then want to print it to a PDF (which I do want to be able to do)? This still won't solve that issue.

Error 2498 means an expression has an incorrect datatype.
Is EventID a number or text field. If a text field, you need text delimiters
Code:
"[Event ID]='" & Me.txtInvoiceTxt & "'"

There is a print to PDF option on the print preview ribbon so that requires no code. Alternatively use report view with a button on the report that runs the above code when it's working
 

Reese

Registered User.
Local time
Today, 13:01
Joined
Jan 13, 2013
Messages
387
Is EventID a number or text field. If a text field, you need text delimiters.

EventID is an AutoNumber field in the table and an unformated textbox in the form. What do you mean by delimiters? Does that still apply?

Also, I would rather avoid having designated "open to view on screen" vs. "print to pdf" command buttons on every form, and I would also prefer to avoid relying on the ribbon, because that would be a bit more cumbersome, though I did test it and it apparently works.

Does anyone have any experience of why the Windows "Print to PDF" printer failing in Access? Because I had it set up to use that and it was working fine for 2+ years, until yesterday. I'd rather solve that core issue than try to find a different technique--even if that technique works. Because if I use a different technique, I have to change a lot of forms and/or user habit throughout the database.
 

Users who are viewing this thread

Top Bottom