Yesterday it was working just fine. and somehow today I re-test the folder was empty but the pdf was saved version 2.
filename = Me.Ref_Number
filepath = "T:\ACCESS DATABASE\" & filename & "\Commercial\" & filename & ".pdf"
filename2 = Me.Ref_Number & "(v2)"
filepath2 = "T:\ACCESS DATABASE\" & filename & "\Commercial\" & filename2 & ".pdf"
If Dir("T:\ACCESS DATABASE\" & filename & "\Commercial\" & filename & " .pdf", vbDirectory) <> "" Then
DoCmd.OutputTo acOutputReport, "OrderCustomerReport", acFormatPDF, filepath
MsgBox "Quotation has been saved successfully", vbInformation, "Save Confirmed"
Application.FollowHyperlink "T:\ACCESS DATABASE\" & Me.Ref_Number & "\Commercial"
Else
DoCmd.OutputTo acOutputReport, "OrderCustomerReport", acFormatPDF, filepath2
MsgBox "Quotation(v2) has been saved successfully", vbInformation, "Save Confirmed"
Application.FollowHyperlink "T:\ACCESS DATABASE\" & Me.Ref_Number & "\Commercial"
End If
Did I missed out anything?
Is the filename the problem or the directory?