Unanswered: sending e-mail from acess, using a query as mailing list.
just wondering if any one can offer me any advice, i have built a acess database, althouhg i now want to be able to send e-mails directly from acess, i am using send object, but this is sent using pre set e-mail adresses, i want it to automatily add all the e-mail adress that are in a select query and send it to all those people, as BCC:
make sure you set a reference to Microsoft Outlook.
Dim rsmytable As Recordset
Dim i1, rcount As String
Dim i As Integer
Dim oMailApp As Outlook.Application
Dim oMail As Outlook.MailItem
Set rsmytable = New ADODB.Recordset
rsmytable.ActiveConnection = CurrentProject.Connection
rsmytable.Open "QRY_EMAIL_ADRS", , adOpenKeyset, adLockOptimistic, _
rcount = rsmytable.RecordCount
For i = 1 To rcount
i1 = rsmytable.Fields("UserName")
Set oMailApp = CreateObject("Outlook.Application")
Set oMail = oMailApp.CreateItem(olMailItem)
.TO = "name@email"
.BCC = i1
.Subject = "test email"
.Body = vbCrLf & vbCrLf & " test "