Hey Genomon,
Having had success with printing to PDF, I now try to merge. Can you help with this please? I downloaded the Plus Pro version of the library, and replaced the standard one, and have registered it and removed the standard in Access. I tried what was in the sample and I have the same memory error as before. I have tried reboots, putting a timer loop in, checking the registry etc. All to no avail. The original part works fine, its just when it comes to merging it falls over now.
Heres the code:
Sub Ferm_onpen(report_tmple, Job_Class_Wanted, SiteCond, frmPath, MyAdmin, MySite, thisLoop)
On Error GoTo Err_Ferm_onpen_Click
Dim strFileName As String, strReportName As String, strTargetName As String
Dim strCondition As String, strReportTitle As String, intLoop As Integer
If MyAdmin = 0 Then 'Report being run by a normal user
DoCmd.OpenReport report_tmple, acViewNormal ', , SiteCond
Else 'Report being run by a Super User and therefore being printed to Acrobat
Dim PDFObj As New pdfclass
Dim strMasterDoc As String 'M
Dim objMerge As MergePDFClass 'M
Dim arrMerge() As String 'M
Dim dwReturn As Long 'M
Dim strBookmarkText As String 'M
ReDim arrMerge(0) 'M
intLoop = thisLoop
strReportName = report_tmple
strFileName = Job_Class_Wanted
strBookmarkText = Chr(124) & " " & strFileName
strFileName = MySite & strFileName & ".PDF"
strTargetName = frmPath & strFileName 'the path and filename of the new document, also the doc to merge
strTargetName = strTargetName & strBookmarkText
strCondition = SiteCond
strMasterDoc = frmPath & MySite & "Detail Report" & ".PDF" 'M The path and filename of the document to be merged into
strReportTitle = "PDFReportTitle" 'M
arrMerge(0) = strTargetName 'M
Debug.Print strReportName
Debug.Print strTargetName
Debug.Print strCondition
Debug.Print strMasterDoc
Debug.Print strReportTitle
Debug.Print "============="
Dim sngStart As Single, sngEnd As Single
Dim sngElapsed As Single
'=========================================
If 1 = 1 Then
If intLoop = 1 Then 'If this is the first loop through, create a document to hold the others. Make it a predefined report in Access.
With PDFObj
.ReportName = strReportTitle
.PDFNoShowPropDlg = True
.OutputFile = strMasterDoc
.PDFEngine = 1
.printimage
End With
Set PDFObj = Nothing
sngStart = Timer ' Get start time.
Do Until sngElapsed = 5 ' wait 5 seconds
sngEnd = Timer ' Get end time.
sngElapsed = Format(sngEnd - sngStart, "Fixed"

' Elapsed time.
Loop
End If
End If
'=========================================
With PDFObj 'Now each report gets created
.ReportName = strReportName
If IsNull(strCondition) = False Then
.ReportWhere = strCondition
End If
.PDFNoShowPropDlg = True
.OutputFile = strTargetName '"C:\FICS\Fred.pdf"
.PDFEngine = 1 '1 is PDF Writer (only one that works with Standard edition), 2 is Distiller (requires Pro version) print driver.
.printimage
End With
Set PDFObj = Nothing
sngStart = Timer ' Get start time.
Do Until sngElapsed = 5 ' wait 5 seconds
sngEnd = Timer ' Get end time.
sngElapsed = Format(sngEnd - sngStart, "Fixed"

' Elapsed time.
Loop
'=========================================
If 1 = 1 Then
Set objMerge = New MergePDFClass 'M now merge each report as it is created into the master document
With objMerge 'M
dwReturn = .MergePDFs(strMasterDoc, arrMerge()) 'M
End With 'M
Set objMerge = Nothing 'M
sngStart = Timer ' Get start time.
Do Until sngElapsed = 5
sngEnd = Timer ' Get end time.
sngElapsed = Format(sngEnd - sngStart, "Fixed"

' Elapsed time.
Loop
End If
'=========================================
End If 'MyAdmin = 0
Exit_Ferm_onpen_Click:
Exit Sub ' Function
Err_Ferm_onpen_Click:
MsgBox Error$
Resume 'Exit_Ferm_onpen_Click
End Sub
Thanks
Bryan
[BigEars]