Send Multiple Emails from Form

S

shmoussa

Hi,

I have a listbox with 5 different options for automated emails. When a
user double clicks on one of these options, I would like a different
query to be run in the background and a new email message to be
created (but not sent) for each record (result) in my query. The
recipient field should remain blank so that the user can manually
enter the names of the recipients for each message. The subject should
be "Automated Email" and the body of the email should be in Rich Text
format and its contents should be taken from the background query.

For example: If a user double clicks the Automated Rejection Letter
option, and my query finds five records that have been rejected: Five
new email windows should be opened, each with no recipient and subject
"Automated Email: Rejection Letter." The bodies of the five emails
should be the same, but with slight differences in content. "To Whom
It May Concern: Your request for <Title> (Example: Funding) has been
rejected on <Date of Rejection> (Example: 9/20/2010).

Is this possible, and if so- how can you please provide an idea of the
best way to do this? I am using Office 2007.

Thank you.
 
S

shmoussa

Hi,

I have a listbox with 5 different options for automated emails. When a
user double clicks on one of these options, I would like a different
query to be run in the background and a new email message to be
created (but not sent) for each record (result) in my query. The
recipient field should remain blank so that the user can manually
enter the names of the recipients for each message. The subject should
be "Automated Email" and the body of the email should be in Rich Text
format and its contents should be taken from the background query.

For example: If a user double clicks the Automated Rejection Letter
option, and my query finds five records that have been rejected: Five
new email windows should be opened, each with no recipient and subject
"Automated Email: Rejection Letter." The bodies of the five emails
should be the same, but with slight differences in content. "To Whom
It May Concern: Your request for <Title> (Example: Funding) has been
rejected on <Date of Rejection> (Example: 9/20/2010).

Is this possible, and if so- how can you please provide an idea of the
best way to do this? I am using Office 2007.

Thank you.

Is this possible?
 
S

shmoussa

Is this possible?- Hide quoted text -

- Show quoted text -

This is the code that I am using so far, but nothing happens when I
double click:

Private Sub cboReport_DblClick(Cancel As Integer)
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)

With MailOutLook
.BodyFormat = olFormatRichText
.To = ""
.Subject = Me.cboReport
.HTMLBody = Me.cboReport.Column(1)
End With
Exit Sub
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error
message is: " & Err.Description
Resume Error_out
Error_out:
End Sub
 
S

shmoussa

This is the code that I am using so far, but nothing happens when I
double click:

Private Sub cboReport_DblClick(Cancel As Integer)
        Dim appOutLook As Outlook.Application
        Dim MailOutLook As Outlook.MailItem
        Set appOutLook = CreateObject("Outlook.Application")
        Set MailOutLook = appOutLook.CreateItem(olMailItem)

            With MailOutLook
            .BodyFormat = olFormatRichText
            .To = ""
            .Subject = Me.cboReport
            .HTMLBody = Me.cboReport.Column(1)
            End With
            Exit Sub
email_error:
            MsgBox "An error was encountered." & vbCrLf & "The error
message is: " & Err.Description
            Resume Error_out
Error_out:
End Sub- Hide quoted text -

- Show quoted text -

Okay, sorry to keep bumping this, but now I got Access creating a new
email by double clicking and using static text in the the email body.
I need help creating multiple new email windows (based on the number
of records that I have in my query (qry_NewEmails)) and I need help
making the text in the email different by pulling data from each
individual record in my qry_NewEmails query.

This is the code that I have so far.

Dim objOLApp As Outlook.Application
Dim NewEmail As Outlook.MailItem

Set objOLApp = New Outlook.Application
Set NewEmail = objOLApp.CreateItem(olMailItem)

NewEmail.Subject = Me.cboReport.Column(0)
NewEmail.HTMLBody = Me.cboReport.Column(1)
NewEmail.Display
 
S

shmoussa

Okay, sorry to keep bumping this, but now I got Access creating a new
email by double clicking and using static text in the the email body.
I need help creating multiple new email windows (based on the number
of records that I have in my query (qry_NewEmails)) and I need help
making the text in the email different by pulling data from each
individual record in my qry_NewEmails query.

This is the code that I have so far.

    Dim objOLApp As Outlook.Application
    Dim NewEmail As Outlook.MailItem

    Set objOLApp = New Outlook.Application
    Set NewEmail = objOLApp.CreateItem(olMailItem)

    NewEmail.Subject = Me.cboReport.Column(0)
    NewEmail.HTMLBody = Me.cboReport.Column(1)
    NewEmail.Display- Hide quoted text -

- Show quoted text -

Anyone? Please.
 

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