principalfuller (AT) gmail (DOT) com wrote:
Quote:
Good Evening,
I am not a programmer or developer, but I've muddled my way through
creating a large Access Database to manage the students at the school
where I am Principal.
I have a querry which lists all of the students who were tardy, and
their parent email address ([Mom Email], and [Dad Email]. I know how
to create the VB code to start an email to an individual parent using
this information, but in my query I have a list of 40 students/recrds
(x 2 fields = 80 email addresses). I want to create a form or
something where I open the list click one button and start an email
with all 80 of those emails in the BCC field of the email.
Does anyone know of a way to do this?
Thank you so much in advance!
Curt |
This is untested but should be close. You could send a report using
SendObject but I left that option blank. What words you don't
understand you can highlight and press F1 in a code module to read the help.
Sub SendParentsEmail()
Dim strE As String
Dim strNote As String
Dim blnEditMsg As Boolean
Dim rst As Recordset
'display in the email program, don't automatically send
blnEditMsg = True
'create a message body
strBody = "Parents, tardiness is not permitted in my school!"
'modify your query name
Set rst = CurrentDb.OpenRecordset("Query1", dbOpenSnapshot)
'loop through the records
Do While Not rst.EOF
'modify the email field name(s)
strE = rst!EmailDad & ";" & rstEmailMom & ";"
rst.MoveNext
Loop
'I don't know if you need the trailing ;. It you dont,
'the following code line will remove it. you might want to
'experiment to see if you do or don't.
strE = Left(strE, Len(strE) - 1)
'ok, the list is created of email names for the bcc
'send an email, just send the subject/body.
'you might want to change the email addy and do it to a smaller
'list and try it out first.
DoCmd.SendObject acSendNoObject, , acFormatTXT, , , strE, _
"Student Tardiness", strBody, blnEditMsg
End Sub