i have this application that scans and attaches documents
when i click convert to pdf button it exports the pdf file in the same directory with jpgs as shown in the image above and they appear in the subform list , but when i scan the second time and then click to convert to pdf the function includes the exported pdf files and deletes the previously converted pdf and replaces it with a pdf contains a blank first page and i want it to only select the jpg files
this is my code:
i want to function to convert the jpg only and the second part of the function to delete only the jpgs and leave only the PDF files in the subform.
please help me.
when i click convert to pdf button it exports the pdf file in the same directory with jpgs as shown in the image above and they appear in the subform list , but when i scan the second time and then click to convert to pdf the function includes the exported pdf files and deletes the previously converted pdf and replaces it with a pdf contains a blank first page and i want it to only select the jpg files
this is my code:
Code:
Private Sub CommandConvertToPdf_Click()
Dim Numberofdocuments As Integer
Numberofdocuments = DCount("IDD", "QPicOfIn")
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
' this removes the converted images
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("Images")
Ttb2.AddNew
Ttb2![IDD] = Forms![Form1]![IDD]
Ttb2![Path] = PathOfFile & NumDoc & "\" & NumDoc & ".pdf"
Ttb2.Update
Me.ImagesSubform.Requery
End Sub
i want to function to convert the jpg only and the second part of the function to delete only the jpgs and leave only the PDF files in the subform.
please help me.
Last edited: