Code to send Access email

S

Stephanie

Hi. I am using two versions of code to send email from Access. My emails
don't contain an attachment, just a list of email recipents. In one version
I allow the user to select an email grouping using an input form, and in the
second version I have sql code within vba.

What I'm wondering is can I send the email to two groups of email
recipients. For example, I want to send email to both Members and the Board
(each are a separate group- then I guess I have issues when someone is a
Member and on the Board, I don't want them to get 2 emails). Or I want to
send email to a group that satisfies one or both of the embedded sql
statements.
It seems the way I have it set up, I'd have to send more than one email (and
no doubt duplicates), which is not so handy. I'd appreciate any suggestions
for both my methods to be able to include more than one "group" without
duplicates. Can it be done? Thanks

1st method
Private Sub EmailGroup_Click()
DoCmd.OpenForm "GroupParamEmail", acNormal, , , , acDialog
End Sub

GroupParamEmail allows the user to select one group and then the code runs.

2nd method
Private Sub EmailMember_Click()
Dim rst As DAO.Recordset
Dim strTo As String
Set rst = CurrentDb.OpenRecordset("SELECT [EmailName] FROM Contacts WHERE
[EmailName] Is Not Null AND [MemberStatusID]=1 AND [MemberTypeID]=1 AND
[MemberOption]=1")
With rst
Do Until .EOF
strTo = strTo & ![EmailName] & ";"
.MoveNext
Loop
.Close
End With
strTo = Left(strTo, Len(strTo) - 1)
Set rst = Nothing
'line that would open Outlook to a new message with the bcc:
'box populated with the list you built in strTo
DoCmd.SendObject acSendNoObject, , , , , strTo, "Member Email Link"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top