I am having trouble running the following code. I am trying to access a query named "Schedule Email List" and I wanting to email a report to each individual in that query. I am getting an error on the set rst line. the error is a runtime 13 error type mismatch. Im sure it is a simple solution but with my limited experience I am having trouble
Thanks
Shawn
Dim db As Database, rst As Recordset
Dim strSQL As String
Dim Names As String
'Return reference to current database
Set db = CurrentDb
strSQL = "SELECT [Schedule Email List].[emailaddressPrimary] FROM [Schedule Email List];"
Set rst = db.OpenRecordset(strSQL)
With rst
.MoveFirst
Names = ![emailaddressPrimary] & ";"
.MoveNext
Do Until .EOF
Names = Names & ![emailaddressPrimary] & ";"
.MoveNext
Loop
End With
'Sending job opportunities to Email Contacts in Joblist Email List
DoCmd.SendObject acSendReport, "Weekly Schedule Report", acFormatRTF, Names, , , "Schedule From" & " " & [Text7] & " until " & [Text9], , -1
rst.Close
End If
Thanks
Shawn
Dim db As Database, rst As Recordset
Dim strSQL As String
Dim Names As String
'Return reference to current database
Set db = CurrentDb
strSQL = "SELECT [Schedule Email List].[emailaddressPrimary] FROM [Schedule Email List];"
Set rst = db.OpenRecordset(strSQL)
With rst
.MoveFirst
Names = ![emailaddressPrimary] & ";"
.MoveNext
Do Until .EOF
Names = Names & ![emailaddressPrimary] & ";"
.MoveNext
Loop
End With
'Sending job opportunities to Email Contacts in Joblist Email List
DoCmd.SendObject acSendReport, "Weekly Schedule Report", acFormatRTF, Names, , , "Schedule From" & " " & [Text7] & " until " & [Text9], , -1
rst.Close
End If