Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2006

    Post Unanswered: Send email to list of recipients Problem

    I have a button on a form that when clicked, will send an email to a list of recipients. I get the following error when the code runs.

    Run-Time Error '424'
    Object required.

    It errors on the line: .Recipients.Add (Tables!Members!Email)

    Please see attached code.
    Any help would be greatly appreciated!

    Private Sub Command0_Click()

    Dim MyDB As Database
    Dim MyRS As Recordset
    Dim ol As Outlook.Application
    Dim ns As NameSpace
    Dim msg As Outlook.MailItem
    Dim objOutlookRecip As Outlook.Recipient
    Dim att As Attachment
    Dim TheAddress As String

    Set MyDB = CurrentDb

    ' Create the Outlook session.
    Set ol = Outlook.Application
    Set ns = ol.GetNamespace("MAPI")

    ' Create the e-mail message.
    Set msg = Outlook.Application.CreateItem(olMailItem)

    With msg
    ' Add the To recipients to the e-mail message.
    .Recipients.Add (Tables!Members!Email)

    ' Set the Subject, the Body, and the Importance of the e-mail message.
    .Subject = "Subject of email"
    .Body = "Body of email"

    .Importance = olImportanceHigh 'High importance

    ' Resolve the name of each Recipient.
    For Each objOutlookRecip In .Recipients
    If Not objOutlookRecip.Resolve Then
    End If
    End With

    Set objOutlookMsg = Nothing
    Set objOutlook = Nothing

    End Sub

  2. #2
    Join Date
    Nov 2011
    Make sure this is at the top of your form code: It should eliminate the problem.
    I design view, add this if it does not already exists.

    Option Compare Database
    Private Sub Form_Open(Cancel As Integer)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts