Query Result To "To:" in Outlook...

B

Bob Barnes

This is on Page 5 right now..I answered Geoff, but don't know if he'll see
this.

Modified from 2 days ago...
I'd like to use a Query to get 950 Records with an "Email" Field which is
not Null (no problem writing the Query) sent to Outlook in the
Contact or "To" Field...

Geoff's answer...
Relatively easy to do using Outlook (part of Microsoft Office) because
Outlook supports VBA and Automation.

Geoff.

I then asked Geoff for sample automation code to Outlook...I've done lots of
Access-to-Excel automation.

TIA - Bob
 
S

Steve Schapel

Bob,

Maybe this will help...

Dim rst As DAO.Recordset
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim StrTo As String

Set rst = CurrentDb.OpenRecordset("SELECT Email FROM YourTable
WHERE Email Is Not Null")
With rst
Do Until .EOF
StrTo = StrTo & ! & ";"
Loop
.Close
End With
StrTo = Left(StrTo, Len(StrTo) - 1)

Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = StrTo
MyMail.Display

Set MyOutlook = Nothing
Set rst = Nothing
 
B

Bob Barnes

Steve - THANK you very much.

Bob

Steve Schapel said:
Bob,

Maybe this will help...

Dim rst As DAO.Recordset
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim StrTo As String

Set rst = CurrentDb.OpenRecordset("SELECT Email FROM YourTable
WHERE Email Is Not Null")
With rst
Do Until .EOF
StrTo = StrTo & ! & ";"
Loop
.Close
End With
StrTo = Left(StrTo, Len(StrTo) - 1)

Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = StrTo
MyMail.Display

Set MyOutlook = Nothing
Set rst = Nothing

--
Steve Schapel, Microsoft Access MVP

[QUOTE="Bob"]
This is on Page 5 right now..I answered Geoff, but don't know if he'll see
this.

Modified from 2 days ago...
I'd like to use a Query to get 950 Records with an "Email" Field which is
not Null (no problem writing the Query) sent to Outlook in the
Contact or "To" Field...

Geoff's answer...
Relatively easy to do using Outlook (part of Microsoft Office) because
Outlook supports VBA and Automation.

Geoff.

I then asked Geoff for sample automation code to Outlook...I've done lots of
Access-to-Excel automation.

TIA - Bob
[/QUOTE]
[/QUOTE]
 

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

Top