fat controller
Slightly round the bend..
- Local time
- Today, 13:32
- Joined
- Apr 14, 2011
- Messages
- 758
I have a couple of procedures based on similar code, and they have all stopped working recently - - I believe as a result of me poking around with reference libraries when trying to get something else to work. Doh!
The code:
It works partially, but does not populate the recipients email addresses into the email. Everything else seems OK.
I have stepped into the code, and it runs through without errors - just no email addresses.
Can anyone point me in the direction of the right reference library that I need to reinstate to fix this?
The code:
Code:
Dim myPath As String
Dim strReportName As String
Dim Bonnet_Number As String
Dim Running_Number As String
Dim Route_Number As String
Dim rs As Recordset
Dim vRecipientList As String
Dim vMsg As String
Dim vSubject As String
Dim streMailReport As String
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "Road_Call_Report", acViewPreview
Bonnet_Number = Reports!Road_Call_Report.[Bonnet Number]
Running_Number = Reports!Road_Call_Report.[Running Number]
Route_Number = Reports!Road_Call_Report.[Route]
strReportName = "Road Call Request" + " " + Bonnet_Number + " - " + Running_Number + " on route " + Route_Number + " " + " - " + Format(Date, "ddmmyyyy") + ".pdf"
Set rs = CurrentDb.OpenRecordset("SELECT * FROM MailRecipientsENG")
If rs.RecordCount > 0 Then
rs.MoveFirst
Do
If Not IsNull(rs!Recipient_Mail) Then
vRecipientList = vRecipientList & rs!Recipient_Mail & ";"
rs.MoveNext
Else
rs.MoveNext
End If
Loop Until rs.EOF
vMsg = "Please see the attached road call request"
vSubject = strReportName
streMailReport = myPath & strReportName
DoCmd.SendObject acSendReport, "Road_Call_Report", acFormatPDF, vRecipientList, , , vSubject, vMsg, False
MsgBox ("Thank you!" & vbLf & vbLf & "The road call request has been successfully sent" & vbLf & vbLf & "Please remember to have your emails open to allow the request to be sent"), vbOKOnly, "Thank you"
Else
MsgBox "No contacts found on mailing list - request NOT sent"
End If
It works partially, but does not populate the recipients email addresses into the email. Everything else seems OK.
I have stepped into the code, and it runs through without errors - just no email addresses.
Can anyone point me in the direction of the right reference library that I need to reinstate to fix this?