hi
the code attached always shows me the pdf file and goes to the folder required
can the code be modified so it does not show me but just goes into the folder
I also would like a message to go to steve.kirk @ api.com to say this pdf is in the folder . but not send the pdf to him
could you please advise how to achieve this
many thanks
steve
the code attached always shows me the pdf file and goes to the folder required
can the code be modified so it does not show me but just goes into the folder
I also would like a message to go to steve.kirk @ api.com to say this pdf is in the folder . but not send the pdf to him
could you please advise how to achieve this
Code:
Private Sub cmdPDF_Click()
On Error GoTo Err_Handler
Const FOLDER_EXISTS = 75
Const MESSAGE_TEXT1 = "No current invoice."
Const MESSAGE_TEXT2 = "No folder set for storing PDF files."
Dim strFullPath As String
Dim varFolder As Variant
If Not IsNull(Me.[P/O Number]) Then
' build path to save PDF file
varFolder = DLookup("Folderpath", "pdfFolder")
If IsNull(varFolder) Then
MsgBox MESSAGE_TEXT2, vbExclamation, "Invalid Operation"
Else
' create folder if does not exist
varFolder = varFolder & "\" & Me.Supplier
MkDir varFolder
'strFullPath = varFolder & "\" & ME.CustomerName & " " & Me.Invoicenumber & ".pdf"
strFullPath = varFolder & "\" & "Purchase order " & " " & Me.[P/O Number] & ".pdf"
' ensure current record is saved before creating PDF file
Me.Dirty = False
DoCmd.OutputTo acOutputReport, "order", acFormatPDF, strFullPath, True
End If
Else
MsgBox MESSAGE_TEXT1, vbExclamation, "Invalid Operation"
End If
Exit_Here:
Exit Sub
Err_Handler:
Select Case Err.Number
Case FOLDER_EXISTS
Resume Next
Case Else
MsgBox Err.Description
Resume Exit_Here
End Select
End Sub
many thanks
steve