i have access application that i can scan/attach documents and then export to pdf; after the scan is complete the file shows in a subform as jpg format and when i click on convert to pdf it converts the list of images to pdf no problem, the problem when i scan again it overwrites the previous pdf file and the exported file contains a blank first page. (sorry for bad english)
this is the vba code for the convert to pdf button
Private Sub CommandConvertToPdf_Click()
Dim Numberofdocuments As Integer
Numberofdocuments = DCount("IDD", "QPicOfConseller01")
If Numberofdocuments = 0 Then
MsgBox "áÇÊæÌÏ ÕæÑÉ áÊÍæíáåÇ", , "ÕÝÍÉ ãÍãæÏ ÚÈÏ ÇáÛÝÇÑ"
End
Else
SetPathOfFiles
NumDoc = Me.IDD
If Len(Dir(PathOfFile & Forms![Form1]![IDD], vbDirectory)) = 0 Then
MkDir PathOfFile & Forms![Form1]![IDD]
End If
DoCmd.OpenReport "ReportToPdf", acViewPreview, , , acHidden
DoCmd.OutputTo acReport, "ReportToPdf", "PDFFormat(*.pdf)", PathOfFile & NumDoc & "\" & NumDoc & ".pdf"
DoCmd.Close acReport, "ReportToPdf", acSaveNo
End If
If Me.OptionDeletePicAfterConvertPDF = -1 Then
DoCmd.GoToControl "ImagesSubform"
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDelete
DoCmd.SetWarnings True
Me.PicView.Requery
End If
Dim Ttb2 As Recordset
Set Ttb2 = CurrentDb.OpenRecordset("Image")
Ttb2.AddNew
Ttb2!\[IDD\] = Forms!\[Form1\]!\[IDD\]
Ttb2!\[Path\] = PathOfFile & NumDoc & "" & NumDoc & ".pdf"
Ttb2.Update
Me.ImagesSubform.Requery
End Sub