Hello,
I have a rather odd problem with MS Access and bullzip. Im converting one by one report (invoice) to PDF with bullzip. The whole process in Access goes without any errors.
However, sometimes I get the error message from the title in bullzip with the next text:
"The process can not access the file ..." (file is located somewhere in temp tabel, unfortunately I dont have the whole error message).
Source: mscorlib
When this happens Access continues to work and finishes the procedure but my PDF files get messy.
What happens is that I store the file under the invoice number 0001 as file name but inside the file is actually the invoice 0002.
Below is my code and it works fine as far as I know and it shouldnt mix the invoices. It somehow seems like that bullzip skips one or gets stuck when the error message appears.
If Not MyRs.EOF Then
MyRs.MoveFirst
While Not MyRs.EOF
IdPotr = MyRs!IdPotrosaca
FileName = Format(IdPotr, "000000") & "_" & Left(MyRs!TekuciMje, 2) & "_" & Right(MyRs!TekuciMje, 2)
FilePath = "D:\Racuni_PDF\" & Right(MyRs!TekuciMje, 4) & "god\" & FileName & ".pdf"
If IsLoaded("rptRacuniA4") Then
DoCmd.Close acReport, "rptRacuniA4", acSaveYes
End If
DoCmd.OpenReport "rptRacuniA4", acViewPreview, , "IdPotrosaca = " & IdPotr & "", acHidden
If IdPotr <> IdPotrPriExp Then
MsgBox "Some random message", vbCritical, "Title"
Exit Sub
End If
PrintInvoice FilePath
If IdPotr <> IdPotrPriExp Then
MsgBox "Some random message", vbCritical, "Title"
Exit Sub
End If
DoCmd.Close acReport, "rptRacuniA4", acSaveNo
MyRs.MoveNext
Wend
End If
Sub PrintInvoice(Optional sFileName As String = "", Optional confirmOverwrite As Boolean = False)
Dim oPrinterSettings As Object
Dim oPrinterUtil As Object
Dim sPrintername As String
Dim sFullPrinterName As String
Application.Printer = Application.Printers("Bullzip PDF Printer")
Set oPrinterSettings = CreateObject("Bullzip.PdfSettings")
Set oPrinterUtil = CreateObject("Bullzip.PdfUtil")
sPrintername = oPrinterUtil.DefaultPrintername
oPrinterSettings.Printername = sPrintername
With oPrinterSettings
.SetValue "Output", sFileName
.SetValue "ConfirmOverwrite", "no"
.SetValue "ShowSettings", "never"
.SetValue "ShowPDF", "no"
.WriteSettings True
End With
DoCmd.PrintOut (acPages)
End Sub
Thanks in advance. If more info is needed I will add.
Error -2147024864 MS Access report to PDF with Bullzip
Moderator: jr