Hi guys, I am having a little bit of trouble getting my DoCmd to execute properly. I am quite new to running code thru event procedures so I'll do my best to explain.
I am needing a query to run and then requery and then email that query to a known email address. Below is what I have come up with and it works up until it trys to send an email and I receive an error message "Run-Time Error '2995': Unknow message recipient(s); the message was not sent."
I have dummied the email address for obvious reasons but it is correct. My guess is that I have a comma or space out of place but just not sure?
Private Sub Text26_AfterUpdate()
Dim stDOCName As String
stDOCName = "qry SVE PURCHASE ORDERS + APPROVAL + TRANSIT RPT by vendor"
DoCmd.OpenQuery stDOCName, acNormal, acEdit
DoCmd.Requery
DoCmd.SendObject acSendQuery, "qry SVE PURCHASE ORDERS + APPROVAL + TRANSIT RPT by vendor", acFormatXLS, _
"MichaelJordan@domain.com", _
"Test Spreadsheet", "Test subject", "This is my message", , False
End Sub
I am needing a query to run and then requery and then email that query to a known email address. Below is what I have come up with and it works up until it trys to send an email and I receive an error message "Run-Time Error '2995': Unknow message recipient(s); the message was not sent."
I have dummied the email address for obvious reasons but it is correct. My guess is that I have a comma or space out of place but just not sure?
Private Sub Text26_AfterUpdate()
Dim stDOCName As String
stDOCName = "qry SVE PURCHASE ORDERS + APPROVAL + TRANSIT RPT by vendor"
DoCmd.OpenQuery stDOCName, acNormal, acEdit
DoCmd.Requery
DoCmd.SendObject acSendQuery, "qry SVE PURCHASE ORDERS + APPROVAL + TRANSIT RPT by vendor", acFormatXLS, _
"MichaelJordan@domain.com", _
"Test Spreadsheet", "Test subject", "This is my message", , False
End Sub