this is an Acknowledge form. if i select "open ACK" I get the reports below which is correct and you can see the e.mail address in it
yet if i select the buttons " email or create ack pdf i get this e.mail error if i select ok the email will show up as show below yet the e.mail address is not in the pdf file like it was on the "open ack " one below is the code for the file to save as PDF
Thanks for your help
steve
yet if i select the buttons " email or create ack pdf i get this e.mail error if i select ok the email will show up as show below yet the e.mail address is not in the pdf file like it was on the "open ack " one below is the code for the file to save as PDF
Thanks for your help
steve
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.id) Then
' build path to save PDF file
' varFolder = "C:\Users\User\Documents"
varFolder = DLookup("Folderpath", "pdfFolder")
If IsNull(varFolder) Then
MsgBox MESSAGE_TEXT2, vbExclamation, "Invalid Operation"
Else
' create folder if does not exist
varFolder = varFolder & "\" & [Order Details subform]![CustomerName]
MkDir varFolder
'strFullPath = varFolder & "\" & ME.CustomerName & " " & Me.Invoicenumber & ".pdf"
strFullPath = varFolder & "\" & "Ackowledgement number " & " " & Me.id & ".pdf"
' ensure current record is saved before creating PDF file
Me.Dirty = False
DoCmd.OutputTo acOutputReport, "order acknowledgement", acFormatPDF, strFullPath
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