M
malibu
I'm running Access 2007 and I recently programmed my db to send an
email of a report. This use to work, but not it doesn't fire. Is the
code correct or could it be improved? I'm running this on XPSP3,
running Access 2007 SP1.
Here is the code.
Private Sub cmdEmailInvoice_Click()
On Error GoTo Err_Button_Click
DoCmd.SendObject acSendReport, "Reingold Tutoring Invoice",
acFormatPDF, DLookup("[Parents_email]", "Customers", "[StudentID] =" _
& Forms![Add Lesson and Details]!StudentID), , , ("Reingold Tutoring"
& " " & MonthName(Month(Date) - 1) & " " & "Invoice"), _
"Dear " & DLookup("[Parents Title]", "Customers", "[StudentID] = " &
Forms![Add Lesson and Details]!StudentID) & " " & _
DLookup("[Parents LastName]", "Customers", "[StudentID] =" & Forms!
[Add Lesson and Details]!StudentID) & "," & _
vbCrLf & vbCrLf & _
"Please find attached your invoice for this past month of lessons.
Payment instructions are listed at the bottom of the invoice." _
& _
vbCrLf & vbCrLf & _
"Thank you very much," & _
vbCrLf & vbCrLf & _
"Reingold Tutoring", True
Err_Button_Click:
If Err.Number = 2501 Then
Resume Next
End If
End Sub
email of a report. This use to work, but not it doesn't fire. Is the
code correct or could it be improved? I'm running this on XPSP3,
running Access 2007 SP1.
Here is the code.
Private Sub cmdEmailInvoice_Click()
On Error GoTo Err_Button_Click
DoCmd.SendObject acSendReport, "Reingold Tutoring Invoice",
acFormatPDF, DLookup("[Parents_email]", "Customers", "[StudentID] =" _
& Forms![Add Lesson and Details]!StudentID), , , ("Reingold Tutoring"
& " " & MonthName(Month(Date) - 1) & " " & "Invoice"), _
"Dear " & DLookup("[Parents Title]", "Customers", "[StudentID] = " &
Forms![Add Lesson and Details]!StudentID) & " " & _
DLookup("[Parents LastName]", "Customers", "[StudentID] =" & Forms!
[Add Lesson and Details]!StudentID) & "," & _
vbCrLf & vbCrLf & _
"Please find attached your invoice for this past month of lessons.
Payment instructions are listed at the bottom of the invoice." _
& _
vbCrLf & vbCrLf & _
"Thank you very much," & _
vbCrLf & vbCrLf & _
"Reingold Tutoring", True
Err_Button_Click:
If Err.Number = 2501 Then
Resume Next
End If
End Sub