Hi I have this piece of code to save a one-page report (a receipt) to a PDF file.
for some unknown reason it usually works, but I find it unstable at times , and fails to execute the "DoCmd.OutputTo" command.
Trying to work it out, I found that if fails because of the strFName variable.
Dim strPath, strFName, strRptName As String
strPath = DLookup("[KabalotPath]", "tblMainPrmtrs") & "\"
strFName = strPath
strFName = strFName & "Rec " & txtNumKabala
strFName = strFName & " " & "Apt " & txtDiraID & " " & txtDayar & ".pdf"
If Dir(strFName) = "" Then
strRptName = Me.Name
DoCmd.OutputTo acOutputReport, strRptName, acFormatPDF, strFName
End if
Thx for your help
Shlomo
for some unknown reason it usually works, but I find it unstable at times , and fails to execute the "DoCmd.OutputTo" command.
Trying to work it out, I found that if fails because of the strFName variable.
Dim strPath, strFName, strRptName As String
strPath = DLookup("[KabalotPath]", "tblMainPrmtrs") & "\"
strFName = strPath
strFName = strFName & "Rec " & txtNumKabala
strFName = strFName & " " & "Apt " & txtDiraID & " " & txtDayar & ".pdf"
If Dir(strFName) = "" Then
strRptName = Me.Name
DoCmd.OutputTo acOutputReport, strRptName, acFormatPDF, strFName
End if
Thx for your help
Shlomo