Report To PDF

lcook1974

Registered User.
Local time
Today, 03:28
Joined
Dec 21, 2007
Messages
330
Good afternoon all,
I have downloaded an AWESOME code to convert snapshot reports into PDF. This thing is great, but the only problem is, I have a DB that will have multiple reports (SOP's) for our organization.

My question is how/where would I go about choosing the names of the SOP's instead of the "report" name and have it run the report and create the PDF for that specific report.

so I know I need to put a filter in there somewhere.

The list box would show the names of the SOP's, then double click or click the button and it would generate the report as normal.

database and modules in question are too big so if you send me a private message I'll e-mail you the DB.
Code:
Private Sub lstRptName_DblClick(Cancel As Integer)
Dim blRet As Boolean
' Call our convert function
blRet = ConvertReportToPDF[B](Me.lstRptName.Value[/B], vbNullString, Me.lstRptName.Value & ".PDF", False)
' To modify the above call to force the File Save Dialog to select the name and path
' for the saved PDF file, simply change the ShowSaveFileDialog param to TRUE.
End Sub
The me.lstRptName.value is where it picks the report to PDF.

Thanks Stephen Lebans...he is the author of this wonderful code.

Larry
 
I guess instead of changing the reports filter, you could change the reports underlying query. The following code will change a query:
Code:
Dim qdf As QueryDef
Dim db As Database

Set db = CurrentDb
Set qdf = db.QueryDefs("myQuery")
qdf.SQL = "my sql with new filter"

qdf.Close
db.Close
Set qdf = Nothing
Set db = Nothing
hth
Chris
 
Thanks Stopher....I'll give it a shot and let you know.
 
I mate, Could I get the code to convert snp to pdf off you, It would be a great help, Its been bugging me for ages
 
Maybe i didn´t get it right but why don´t you use pdf printer? http://www.cutepdf.com/products/cutepdf/Writer.asp It´s free, even for commercial use. Set this as default in your report setup and create as many pdf-s as you like. No VBA needed.

This is a nice tool too. But, using this one, you need to make sure each PC that will be using the database has this installed.

The beauty of using the Lebans code, is you just call the procedure. There are two dll files that need to be put on the PC using the database, but I have basically embedded them in the database and when I call the pdf procedure, I copy the dll files to the pc if they aren't there. So when I use the PDF code in VBA, there is nothing to install. I just deploy my access application and let it do the rest.
 

Users who are viewing this thread

Back
Top Bottom