I have a Query that returns results based on due date. This is working fine.Problem is I would like all records that contain an email_address to be sent a custom email using the fields from the query. for Example the Query returns
Title: Mr
FirstName:BOB
Lastname:Jones
ExpiredDate:1/1/10
Days:-186
Notified:No
------------------
Title: Mrs
FirstName:Rachael
LastName:Jones
ExpiredDate:2/1/10
Says:-185
Notified:No
------------------
etc..
how would I Implement this into a custom email which would look like this:
Dear Mr Jones,
our records indicate that your subscription has expired on the 1/1/10 which is -186 days old.
Please let us know weather you would like us to update your subscription by replying to this email.
Thank You!
After the Email has been sent would it be possible to change the Notified: Yes, or would manual be best.
I am wondering if something like the following code could be modified to do what I need?. if so how?
Expand|Select|Wrap|Line Numbers
- dim qdf as dao.querydef
- dim rst as dao.recordset
- set qdf=DBEngine(0)(0).Querydefs("YourSelectQuery")
- set rst=qdf.OpenRecordset
- do until rst.EOF
- DoCmd.SendObject acSendNoObject,,, rst.Fields("EMailAddress")
- '<--Fill in the args as necessary from the recordset
- rst.MoveNext
- Loop
- rst.Close
- set rst=nothing
- set qdf=nothing
Expand|Select|Wrap|Line Numbers
- # Dim MyDB As DAO.Database
- # Dim rst As DAO.Recordset
- #
- # Set MyDB = CurrentDb
- # Set rst = MyDB.OpenRecordset("Orders Qry", dbOpenForwardOnly)
- #
- # With rst
- # Do While Not .EOF
- # Mailbody = Mailbody & ![OrderID] & " | " & ![CustomerID] & " | " & ![ShippedDate] & vbCrLf
- # .MoveNext
- # Loop
- # End With
- #
- # rst.Close
- # Set rst = Nothing
- #
- # oMail.Body = Mailbody