By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,581 Members | 2,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,581 IT Pros & Developers. It's quick & easy.

MS Access - Send Email to Query List

P: 10
I am desperate for some code that works, I had no success with my last posted thread. Instead of showing the code I've used (not working), please post a working code to help me out.

I have a simple contact database, I've queried a list of email newsletter subscribers, I want to insert these email addresses into the BCC field of a new/blank email (default email program). How can I do this?

Thank you in advance of mighty code masters...
Mar 30 '07 #1
Share this Question
Share on Google+
4 Replies


iburyak
Expert 100+
P: 1,017
In Visual Basic References check
Microsoft Outlook 11.0 Object Library

Use this code:

[PHP]Dim objOutlook As New Outlook.Application
Dim objMailItem As MailItem
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
.bcc = "list of recipients here"
.Subject = "Test"
.Body = "TEST"
.Send
End With[/PHP]

Good Luck.
Mar 30 '07 #2

P: 10
The problem I'm having in not sending the email, but rather, referencing the email addresses from the database into the bcc field.

Can anybody give me some example code to gather the email addresses from my query into the bcc field of a single blank email.

Thanks
Mar 30 '07 #3

iburyak
Expert 100+
P: 1,017
You've got an answer to this question here:

http://www.thescripts.com/forum/thread623078.html
Mar 30 '07 #4

iburyak
Expert 100+
P: 1,017
Your full code should look something like this:

[PHP]Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim rcpts As String

Set db = CurrentDb
Set rst = db.OpenRecordset("EmailInfo Clients")
rcpts = ""

With rst
.MoveFirst
Do Until .EOF
rcpts = rcpts & .Fields("Email_Name") & ";"
.MoveNext
Loop
End With

Dim objOutlook As New Outlook.Application

Dim objMailItem As MailItem

Set objMailItem = objOutlook.CreateItem(olMailItem)

With objMailItem

.bcc = rcpts

.Subject = "Test"

.Body = "TEST"

.Send

End With [/PHP]


Good Luck.
Mar 30 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.