P
purelife via AccessMonster.com
I am using Access 2000. Below is my coding on a macro which I am using to
automate a emails to be sent out which include an excel file. This file will
be sent out to those vendors who are pulled up using a query. When I get
down to the line "strEmail = rs!("Email") it turns up a compile error stating
"Type-declaration character does not match declared type". Does anyone have
a solution to this problem? I'd really appreciate it! Thanks! *"Info"
denotes any information that I can't share outside of my company
Sub Checklist()
Dim rs As New ADODB.Recordset
Dim fso As New FileSystemObject
Dim mail As New Outlook.Application
Dim db As ADODB.Connection
Set db = CurrentProject.Connection
rs.CursorLocation = adUseClient
strSQL = " Info"
strSQL = strSQL & " FROM Info]"
strSQL = strSQL & " WHERE ((([Info].[Date of C-TPAT Expiration]) <=
DateAdd('m', 6, Date())))"
strSQL = strSQL & " ORDER BY [Info].[Date of C-TPAT Expiration];"
rs.Open strSQL, db
If rs.RecordCount < 1 Then
rs.Close
Exit Sub
End If
mail.CreateItem (olMailItem)
strFile = fso.GetFile("File Location")
With rs
Do Until .EOF
strEmail = rs!("Email")
'DoCmd.SendObject(,,, _
'To:=[Queries]![ClientEmails]![ContactEmail], _
'Subject:="Supplier Checklist", _
'MessageText:="Message Text",C:\Info\Info.xls)
..MoveNext
Loop
..Close
End With
Set rs = Nothing
End Sub
automate a emails to be sent out which include an excel file. This file will
be sent out to those vendors who are pulled up using a query. When I get
down to the line "strEmail = rs!("Email") it turns up a compile error stating
"Type-declaration character does not match declared type". Does anyone have
a solution to this problem? I'd really appreciate it! Thanks! *"Info"
denotes any information that I can't share outside of my company
Sub Checklist()
Dim rs As New ADODB.Recordset
Dim fso As New FileSystemObject
Dim mail As New Outlook.Application
Dim db As ADODB.Connection
Set db = CurrentProject.Connection
rs.CursorLocation = adUseClient
strSQL = " Info"
strSQL = strSQL & " FROM Info]"
strSQL = strSQL & " WHERE ((([Info].[Date of C-TPAT Expiration]) <=
DateAdd('m', 6, Date())))"
strSQL = strSQL & " ORDER BY [Info].[Date of C-TPAT Expiration];"
rs.Open strSQL, db
If rs.RecordCount < 1 Then
rs.Close
Exit Sub
End If
mail.CreateItem (olMailItem)
strFile = fso.GetFile("File Location")
With rs
Do Until .EOF
strEmail = rs!("Email")
'DoCmd.SendObject(,,, _
'To:=[Queries]![ClientEmails]![ContactEmail], _
'Subject:="Supplier Checklist", _
'MessageText:="Message Text",C:\Info\Info.xls)
..MoveNext
Loop
..Close
End With
Set rs = Nothing
End Sub