I have the following code (compliments from the guys on this forum)
Dim db As DAO.Database, rst As DAO.Recordset
Set db = CurrentDb
Dim objOutlook As Outlook.Application
Dim Myitem
Dim strTextLine As String
Dim strTemplate As String
strTemplate = "It's that time again." & Chr(13) & Chr(10) _
& "Can you please supply your info for the following equipment." & Chr(13) & Chr(10)
Set rst = db.OpenRecordset("Select * from eqryNewReadingsMail Where Month(duedate)=5 AND Year(duedate)=2002"
Set objOutlook = CreateObject("Outlook.Application"
'Cycle through the table, sending it to each person on the list
Do While Not rst.EOF
Set Myitem = objOutlook.CreateItem(olMailItem)
Myitem.Subject = "Equipment info time."
Myitem.SentOnBehalfOfName = "Readings"
Myitem.Body = vbCrLf & strTemplate
Myitem.To = CStr(rst!ContEmail)
Myitem.Send
If Not rst.EOF Then
rst.MoveNext
End If
Loop
Set objOutlook = Nothing
rst.Close
Set rst = Nothing
Set db = Nothing
Exit_btnContinue_Click:
Exit Sub
Err_btnContinue_Click:
MsgBox Err.Description
Resume Exit_btnContinue_Click
End Sub
Now this works OK, but it sends the mail using my default Outlook Email address. What I would like to do is either provide a mail link in the mail (for replying to) or have the email sent by a different address so that when they reply it goes to the email address I want it to not the my default Outlook email address.
Any ideas would be much appreciated.
TIA
Howard
Dim db As DAO.Database, rst As DAO.Recordset
Set db = CurrentDb
Dim objOutlook As Outlook.Application
Dim Myitem
Dim strTextLine As String
Dim strTemplate As String
strTemplate = "It's that time again." & Chr(13) & Chr(10) _
& "Can you please supply your info for the following equipment." & Chr(13) & Chr(10)
Set rst = db.OpenRecordset("Select * from eqryNewReadingsMail Where Month(duedate)=5 AND Year(duedate)=2002"
Set objOutlook = CreateObject("Outlook.Application"
'Cycle through the table, sending it to each person on the list
Do While Not rst.EOF
Set Myitem = objOutlook.CreateItem(olMailItem)
Myitem.Subject = "Equipment info time."
Myitem.SentOnBehalfOfName = "Readings"
Myitem.Body = vbCrLf & strTemplate
Myitem.To = CStr(rst!ContEmail)
Myitem.Send
If Not rst.EOF Then
rst.MoveNext
End If
Loop
Set objOutlook = Nothing
rst.Close
Set rst = Nothing
Set db = Nothing
Exit_btnContinue_Click:
Exit Sub
Err_btnContinue_Click:
MsgBox Err.Description
Resume Exit_btnContinue_Click
End Sub
Now this works OK, but it sends the mail using my default Outlook Email address. What I would like to do is either provide a mail link in the mail (for replying to) or have the email sent by a different address so that when they reply it goes to the email address I want it to not the my default Outlook email address.
Any ideas would be much appreciated.
TIA
Howard