I'm trying to create a new email message from Outlook based on a query
called Q_Email with the BCC field populated with the email address
field in the query.
When i run this code, the query ressults pop up with a message saying
Object Required.
Thoughts?
Private Sub BCCMail_Click()
On Error GoTo Err_BCCMail_Click
Dim MyOutlook As New Outlook.Application
Dim MyMail As Outlook.MailItem
Dim StrBCC As String
Dim stDocName As String
stDocName = "Q_Email"
DoCmd.OpenQuery stDocName, acNormal, acEdit
With rst
Do Until .EOF
StrBCC = StrBCC & ![EmailAddress] & ";"
Loop
..Close
End With
StrBCC = Left(StrBCC, Len(StrBCC) - 1)
Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.BCC = StrBCC
MyMail.Display
Set MyOutlook = Nothing
Set rst = Nothing
Exit_BCCMail_Click:
Exit Sub
Err_BCCMail_Click:
MsgBox Err.Description
Resume Exit_BCCMail_Click
End Sub