S
Stephanie
Hi. I don't know what I'm doing ;-) Newbie Alert.
I'm trying to get Access to create an email containing the
email address in the Bcc field of those that want to
receive the email (EmailHydrant = Yes). I don't want to
send any Access objects.
One of the MVP helped with some code, but I'm not sure
what to do with it. I decided to use DoCmd.SendObject but
am having problems with the syntax. Grr.
When I click the command button, I want Access to open up
Outlook and populate the Bcc field with the correct email
list, so I can fill in the message text and send the email.
I appreciate your time and hope you have some detailed
suggestions. Thanks, Stephanie
Private Sub EmailHydrant_Click()
DoCmd.SendObject
acSendNoObject,,acFormatRTF,,,Bcc,"Hydrant Email Link",,,,
Dim rst As DAO.Recordset
Dim strTo As String
Set rst = CurrentDb.OpenRecordset("SELECT [EmailName]
FROM Contacts WHERE [EmailName] Is Not Null" And
[EmailHydrant] = -1)
With rst
Do Until .EOF
strTo = strTo & ![EmailName] & ";"
.MoveNext
Loop
.Close
End With
strTo = Left(strTo, Len(strTo) - 1)
Set rst = Nothing
End Sub
I'm trying to get Access to create an email containing the
email address in the Bcc field of those that want to
receive the email (EmailHydrant = Yes). I don't want to
send any Access objects.
One of the MVP helped with some code, but I'm not sure
what to do with it. I decided to use DoCmd.SendObject but
am having problems with the syntax. Grr.
When I click the command button, I want Access to open up
Outlook and populate the Bcc field with the correct email
list, so I can fill in the message text and send the email.
I appreciate your time and hope you have some detailed
suggestions. Thanks, Stephanie
Private Sub EmailHydrant_Click()
DoCmd.SendObject
acSendNoObject,,acFormatRTF,,,Bcc,"Hydrant Email Link",,,,
Dim rst As DAO.Recordset
Dim strTo As String
Set rst = CurrentDb.OpenRecordset("SELECT [EmailName]
FROM Contacts WHERE [EmailName] Is Not Null" And
[EmailHydrant] = -1)
With rst
Do Until .EOF
strTo = strTo & ![EmailName] & ";"
.MoveNext
Loop
.Close
End With
strTo = Left(strTo, Len(strTo) - 1)
Set rst = Nothing
End Sub