Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004

    Unanswered: email to a group in access

    i have a contact database that will have name, company, email, event and group field. The group is a dropdown box. Each name belongs to a specific group. I would like to have letter (report) to send the email that has letter attached to the group. Can you give me an idea? Also we like the sender is always the same address no matter who use the database. Is it possible? Many thanks.

  2. #2
    Join Date
    Aug 2003
    Cleveland USA
    I don't know about how to force the "from" name, but here is how you can create the email. I modified this from a program I wrote, so you may need to add a little error checking.

    Public Function SendEmail()
    On Error GoTo SendEmail_Error

    Dim rst As Object
    Dim strTo As String
    Dim strSubject As String
    Dim strBody As String
    Dim lngCount As Long
    Dim strGroupFromDropdown as string

    strSQL = "SELECT [RecipientEmail] from qryEmail WHERE Group= ‘"
    strSQL = strSQL & strGroupFromDropdown & “’”

    Set rst = CurrentDb.OpenRecordset(strSQL)


    lngCount = rst.RecordCount

    For x = 1 to lngCount
    strTo = strTo & rst(“RecipientEmail”) & ";"
    Next x


    strSubject = “Put text here, can construct from database fields”
    strBody = “Put text here, can construct from database fields”

    If Not IsNull(strTo) Then
    DoCmd.SendObject , , , strTo, , , strSubject, strBody, 0
    MsgBox "There is no name available for sending the message.", vbInformation, "Unable to send email"
    End If

    Exit Function

    MsgBox "There was an error."
    Exit Function

    End Function

  3. #3
    Join Date
    Mar 2004
    Thank you very much! I will try.

Posting Permissions

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