ferociousllama
Registered User.
- Local time
- Today, 09:08
- Joined
- Dec 11, 2015
- Messages
- 10
You all have been great on my previous question and i appreciate the help!
I'm working on creating code to run a query to get a list of mail addresses. Then loop through the mail addresses sending a report to each one. I got that to work but I want to use this with a report with parameters. The parameter I want set for each report is the mail I want it sent to...Not sure if that makes sense.
The recordset creates abmail for address1 I want the parameter for the report to be address1 then I want the code to loop to address2.
I hope this makes sense. here's the code I have so far but I'm not sure if Sendobject is going to work for this.
I kept getting a message about posting electronic mail addresses and it made me change all occurences of the shortened single word for electronic mail address. I changed the "E" to "g" in the code below.
I'm working on creating code to run a query to get a list of mail addresses. Then loop through the mail addresses sending a report to each one. I got that to work but I want to use this with a report with parameters. The parameter I want set for each report is the mail I want it sent to...Not sure if that makes sense.
The recordset creates abmail for address1 I want the parameter for the report to be address1 then I want the code to loop to address2.
I hope this makes sense. here's the code I have so far but I'm not sure if Sendobject is going to work for this.
I kept getting a message about posting electronic mail addresses and it made me change all occurences of the shortened single word for electronic mail address. I changed the "E" to "g" in the code below.
Code:
Dim MyDB As DAO.Database
Dim rstgmail As DAO.Recordset
Dim strBuild As String
Set MyDB = CurrentDb
Set rstgmail = MyDB.OpenRecordset("Rt_gmailQ", dbOpenForwardOnly)
With rstgmail
Do While Not .EOF
strBuild = strBuild & ![gmail] & ";" 'Build the 'TO' String
.MoveNext
Loop
End With
If strBuild <> "" Then 'At least 1 Recipient
strBuild = Left$(strBuild, Len(strBuild) - 1) 'Remove Trailing ';'
DoCmd.SendObject acSendReport, "RaceresultsR", "HTML(*.html)", strBuild, "", "", "Race results", "", True, ""
End If
rstgmail.Close
Set rstgmail = Nothing