PC Review


Reply
Thread Tools Rate Thread

Bulk Email From Access

 
 
Eoin McGlynn
Guest
Posts: n/a
 
      17th Feb 2010
I am try to send the same mail to multiple people from access. There are 2
parts:

1. Select the mail template

Private Sub cmdBrowse_Click()

'Filter the Open dialog to Outlook template files
dlgCommon.Filter = "*.oft"

'Display the Open dialog
dlgCommon.ShowOpen

'Populate txtTemplate with the selected file
Me.txtTemplate = dlgCommon.FileName
End Sub

I seem to have a problem at the dlgcommon.filter stage and can't figure you
why?

2. Send the mail

Option Compare Database
Option Explicit
Private mobjOutlook As Outlook.Application
Private mobjCurrentMessage As Object

Sub Email_Click()

' Customize a message for each contact and then send or save the message
Dim intMessageCount As Integer

'Declare and instantiate a recordset object
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset

'Open a recordset based on the result of qryBulkMail
rst.Open "qryBulkMail", CurrentProject.Connection
intMessageCount = 0

Set mobjOutlook = CreateObject("Outlook.Application")

' Loop through the contacts in the open folder
Do Until rst.EOF
' Check that the contact has an email address.
If rst("EmailAddress") <> "" Then

'Create a mail item based on the selected template
Set mobjCurrentMessage =
mobjOutlook.CreateItemFromTemplate(Me.txtTemplate)

'Add the email address as the recipient for the message
mobjCurrentMessage.Recipients.Add rst("EmailAddress")

' Send the message
mobjCurrentMessage.Send

intMessageCount = intMessageCount + 1
End If
rst.MoveNext
Loop

' Write the number of messages created to the worksheet
MsgBox intMessageCount & " Messages Sent"
End Sub

HEre I have an error @ rst.Open "qryBulkMail",
 
Reply With Quote
 
 
 
 
Eoin McGlynn
Guest
Posts: n/a
 
      17th Feb 2010
Embarrassingly I forget to add the active-x control for the dialog box…

But I still have the error send the mail


"Eoin McGlynn" wrote:

> I am try to send the same mail to multiple people from access. There are 2
> parts:
>
> 1. Select the mail template
>
> Private Sub cmdBrowse_Click()
>
> 'Filter the Open dialog to Outlook template files
> dlgCommon.Filter = "*.oft"
>
> 'Display the Open dialog
> dlgCommon.ShowOpen
>
> 'Populate txtTemplate with the selected file
> Me.txtTemplate = dlgCommon.FileName
> End Sub
>
> I seem to have a problem at the dlgcommon.filter stage and can't figure you
> why?
>
> 2. Send the mail
>
> Option Compare Database
> Option Explicit
> Private mobjOutlook As Outlook.Application
> Private mobjCurrentMessage As Object
>
> Sub Email_Click()
>
> ' Customize a message for each contact and then send or save the message
> Dim intMessageCount As Integer
>
> 'Declare and instantiate a recordset object
> Dim rst As ADODB.Recordset
> Set rst = New ADODB.Recordset
>
> 'Open a recordset based on the result of qryBulkMail
> rst.Open "qryBulkMail", CurrentProject.Connection
> intMessageCount = 0
>
> Set mobjOutlook = CreateObject("Outlook.Application")
>
> ' Loop through the contacts in the open folder
> Do Until rst.EOF
> ' Check that the contact has an email address.
> If rst("EmailAddress") <> "" Then
>
> 'Create a mail item based on the selected template
> Set mobjCurrentMessage =
> mobjOutlook.CreateItemFromTemplate(Me.txtTemplate)
>
> 'Add the email address as the recipient for the message
> mobjCurrentMessage.Recipients.Add rst("EmailAddress")
>
> ' Send the message
> mobjCurrentMessage.Send
>
> intMessageCount = intMessageCount + 1
> End If
> rst.MoveNext
> Loop
>
> ' Write the number of messages created to the worksheet
> MsgBox intMessageCount & " Messages Sent"
> End Sub
>
> HEre I have an error @ rst.Open "qryBulkMail",

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk Email Directly from Access Toxalot Microsoft Access 2 21st May 2011 08:33 PM
Bulk Email from Access Hardboiledegghead Microsoft Access VBA Modules 1 4th Dec 2007 09:51 PM
Bulk email from Access/VBA =?Utf-8?B?Sm9obg==?= Microsoft Access VBA Modules 13 15th Jan 2006 11:05 PM
How do I send bulk email using email addresses from Access field? =?Utf-8?B?U2FyYWg=?= Microsoft Access 4 4th May 2005 08:47 PM
Bulk Email from Access Listing =?Utf-8?B?S2Vycnk=?= Microsoft Access Queries 2 19th Jan 2005 09:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:57 AM.