Good Afternoon, Could someone please help the code list below works with one failing.
THe code loops through a list "Contractors With Jobs Not Atteded On Time" sending a report "Jobs Not Achieving Attended On Time" to the relevant email address this works perfectly attaching the correct report but not the filename is incorrect.
Please anyone help???
Private Sub Command134_Click()
Dim MyDb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
Set MyDb = CurrentDb()
Set rsEmail = MyDb.OpenRecordset("Contractors With Jobs Not Atteded On Time", dbOpenSnapshot)
Do Until rsEmail.EOF
Me.Combo130 = rsEmail!Contractor
sToName = rsEmail!Email
sSubject = "Jobs Not Achieving Attended On Time " & rsEmail!Email
sMessageBody = "Please Find Attached Jobs Not Achieving Attended On Time " & rsEmail!Contractor
Const cTIME = 1500 'in MilliSeconds
Call sSleep(cTIME)
DoCmd.SendObject acSendReport, "Jobs Not Achieving Attended On Time", acFormatRTF, sToName, , , sSubject, sMessageBody, False, False
rsEmail.MoveNext
Loop
Set MyDb = Nothing
Set rsEmail = Nothing
End Sub
Bookmarks