Stephen Lebans PDF Converter Code - Problems

Dear Experts,

I regularly use Lebens PDF converter and have never witnessed any problems in access 2003.

When i try to run the same code in access 2007 some bizzare things happen.

I have several buttons on a form, all of which create different pdf documents, all have essentially the same code under them just creating different reports.

One of them works fine, the others all hang up on the DoCmd.OutputTo line in lebans code, some script runs but never creates the snapshot file - no error just nothing.

If i change the file name in the none working codes to the one in the working codes that also runs fine but i have checked and all the reports are there waiting to be printed.

As soon as i change the output filename to anything else, everything hangs up but only in access 2007!

Any help most welcome.
SweetingAAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I'm wondering if the SnapShot viewer is required. The Viewer is not included with 2007 by default, so you may need to install it:

http://support.microsoft.com/kb/928357

There's a link at the bottom of that KB article where you can download the viewer.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SweetingAAuthor Commented:
I have loaded the snapshot viewer and pdf viewer but none of them seem to address the problem
0
SweetingAAuthor Commented:
Also, if the snapshot viewer were the problem all reports would not be created but one of them works perfectly every time, the others with the same code do not
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<Any help most welcome.>>

 Shot in the dark, but I would:

1. In VBA in tools/reference, check any unchecked reference (doesn't matter which). Close the DB and access, re-open and un-check the reference just checked (will be last).  Then do a compile and make sure you have no errors.  This forces a refresh of all the references that VBA is using.

2. Failing that working, create a fresh DB and import everything into it or use /decompile on the existing DB.

 Anytime VBA doesn't work as you exepect, you need to suspect a reference problem, or that the source and compile p-code has gotten out of sync.

Jim.
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Also, can you show us the code that fails?
0
Jeffrey CoachmanMIS LiasonCommented:
<Aside>

<I have several buttons on a form, all of which create different pdf documents, all have essentially the same code under them just creating different reports.>
 
First, post back the the previous experts with your findings for their respective  posts.

Going forward, you may want to consider using one sub/function to generate all the PDF.
Then call that one sub/function for each different PDF

JeffCoachman
0
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
On Jeff's point, there are many other ways of generating PDF's.

Jim.
0
SweetingAAuthor Commented:
This code fails and the one below does not....

Private Sub CUEmail_Click()

On Error GoTo Err_CUEmail_Click

Dim qdf As QueryDef

Set qdf = CurrentDb.QueryDefs("qry_CO_CustomerConcernsPDF")
qdf.SQL = "SELECT tmptbl_CO_CustomerConcernsCopy.* FROM tmptbl_CO_CustomerConcernsCopy " _
& "WHERE (tmptbl_CO_CustomerConcernsCopy.[Our Ref] In (" & Me.txtOurRef & "))"
Set qdf = Nothing

With DoCmd
    .SetWarnings False
    .OpenQuery "qry_CO_CustomerConcernsCopy_Mtbl"
    .OpenQuery "qry_CO_CustomerConcernsPDF"
    .Close acQuery, "qry_CO_CustomerConcernsPDF", acSaveYes
    .SetWarnings True
End With

Dim blRet As Boolean

blRet = ConvertReportToPDF("rep_CO_ConcernReportPDF", vbNullString, "f:\Quality Systems\Customer Concerns\rep_CO_ConcernReportPDF.pdf", False, True, 150, "", "", 0, 0, 0)

Call OpenCUEmail(Me.txtOurRef, Me.Customer, Me.Nature_of_complaint)

Exit_CUEmail_Click:
    Exit Sub

Err_CUEmail_Click:
    MsgBox Err.Description
    Resume Exit_CUEmail_Click
   
End Sub

--------------------------------------------

This code works

Private Sub CNEmail_Click()

On Error GoTo Err_CNEmail_Click

If IsNull(Me.Customer_Ref) Then
    Me.Customer_Ref = "Not Supplied"
End If

Me.Dirty = False

Dim qdf As QueryDef

Set qdf = CurrentDb.QueryDefs("qry_CO_CustomerConcernsPDF")
qdf.SQL = "SELECT tmptbl_CO_CustomerConcernsCopy.* FROM tmptbl_CO_CustomerConcernsCopy " _
& "WHERE (tmptbl_CO_CustomerConcernsCopy.[Our Ref] In (" & Me.txtOurRef & "))"
Set qdf = Nothing

With DoCmd
    .SetWarnings False
    .OpenQuery "qry_CO_CustomerConcernsCopy_Mtbl"
    .OpenQuery "qry_CO_CustomerConcernsPDF"
    .Close acQuery, "qry_CO_CustomerConcernsPDF", acSaveYes
    .SetWarnings True
End With

Dim blRet As Boolean

blRet = ConvertReportToPDF("rep_CO_ConcernNotification", vbNullString, "f:\Quality Systems\Customer Concerns\rep_CO_ConcernNotification.pdf", False, True, 150, "", "", 0, 0, 0)

Call OpenCNEmail(Me.txtOurRef, Me.Customer, Me.Nature_of_complaint)

Exit_CNEmail_Click:
    Exit Sub

Err_CNEmail_Click:
    MsgBox Err.Description
    Resume Exit_CNEmail_Click
   
End Sub

Only difference is the report name and the output filename.......

All the code works in Access 2003!
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
If you open those trouble reports directly in Access, do they open? That is, using the Access interface, find and open that report - any problems when doing it that way?
0
Jeffrey CoachmanMIS LiasonCommented:
Reply to LSM first...

I am having trouble understanding what the query def code is for, ...and also what running all those queries does...

...as a shot in the dark try adding that same "me.dirty=false" into the code that fails?
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I am having trouble understanding what the query def code is for, ...and also what running all those queries does...
Me too. Only thing I can think of is perhaps those are make-table queries, and the report uses data from those tables?

But then in the first code (the one that fails), the query named "qry_CO_CustomerConcernsPDF" seems to be a simple SELECT Query, so I'm not sure why it would need to be opened at all.

Sweetinga: You might try removing the "SetWarnings" lines temporarily to see if you're getting errors when those queries open.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.