User login

Who's online

There are currently 1 user and 95 guests online.

Online users

Advertisements


SourceForge.net Logo

Using PDF Creator from MS Access

Submitted by jasonbeach on Thu, 2007-12-06 23:54.

I am wanting to output various reports from a MS Access database I have. I can print to the PDFCreator with no problem. My question is, is there a way to print two or more reports to one pdf file? Is the an object model for the pdfCreator class?

Thanks,
Jason

Submitted by dudley on Sun, 2008-06-08 15:56.

Hi, I've been working on the same thing. It works intermittently and I can't figure it out. It's important to me that my AutoSave settings don't get saved by PDFCreator, so my Access app doesn't "take over" the PDFCreator installation for my users. I've used somebody else's trick of forcing the PDFCreator executables to use XP instead of Vista, and that seems to be working. The thing that doesn't seem to be working consistently is the setting of the Autosave options. If I insert a code break after setting the options so I can verify them, they are set as I want. But if I just run the code, they aren't necessarily set and I get the file save window after the .cCombineAll. I've tried putting in some interval of 'sleep" after setting the options, but that doesn't seem to make a difference. It's only totally consistent if I put in a debug stop and check the settings before continuing with sending files to PDFCreator. Does anyone have any suggestions?? Thank you!

Here's my code:

Public Sub PrintRPTToPDFCreator()

Dim PDFCreator1 As PDFCreator.clsPDFCreator
Dim DefaultPrinter As String
Dim c As Long
Dim OutputFilename As String

Set PDFCreator1 = New clsPDFCreator

With PDFCreator1
.cStart "/NoProcessingAtStartup", True
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = "''\Reports\"
.cOption("AutosaveFilename") = "Report_''"
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cOption("AutosaveStartStandardProgram") = 1
'If I put a break point here and manually check the options, they are set
'as given, but if I don't, the settings aren't reflected in the options -
'I know this because the file save box comes up - autosave doesn't work.
'I tried entering various values for sleeping below, in case the system needs
'time, but that doesn't seem to make a difference.
Sleep 4000

'these lines hold the identity of the system's default printer so it can be reset
DefaultPrinter = .cDefaultprinter
.cDefaultprinter = "PDFCreator"
.cClearcache

'so i can see what's going on
.cSaveOptionsToFile ("C:\Users\Hope\Documents\PDFCreator.ini")

'My loop to print all the reports -
'create a variable 'intRPTCounter' that will keep track of how many reports being generated

Dim counter As Integer
Dim intRptCounter As Integer
Dim strItem As String
Dim strReport As String

counter = 1
intRptCounter = 0

'Run through the checkboxes to count the Reports to be generated
For counter = 1 To 3

strItem = "ckItem" & counter

'If Item is checked, then count it
If Forms!frmRPTS_To_PDF.Controls(strItem) = -1 Then
intRptCounter = intRptCounter + 1
End If
Next counter

'reset counter for next loop
counter = 1

'Start looping through the item checkboxes and create reports as indicated
For counter = 1 To 3

strItem = "ckItem" & counter

'If Item is checked, then create the report
If Forms!frmRPTS_To_PDF.Controls(strItem) = -1 Then
strReport = "rptReport" & counter
DoCmd.OpenReport strReport, acViewDesign, , , acHidden
Reports(strReport).Caption = strReport 'or whatever you want
DoCmd.Close acReport, strReport, acSaveYes
DoCmd.OpenReport strReport, acViewNormal
End If

Next counter ...

Note: My code is being truncated here so I'm going to continue it in the following post...

-Dudley
Vista Business, Access 2003

© 2006 by pdfforge.org :: Contact us

Validate XHTML or CSS.