Results 1 to 3 of 3
  1. #1
    bbrazeau is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    101

    Creating a temp mailing list


    I am working on a DB for my church. It has a main form with member details pulled from other tables (ie. Gender,State,Affiliated church, etc) It has many members and I would like to provide a way for the pastor to dynamically select a group of members and run a mail merge on it to produce form letters to those selected. What is the best way to accomplish this? Could someone give an example?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    For mail merge or Access report, can use parameterized query.

    Options:

    1. a yes/no field in table, report is filtered by the setting of this field, use a form to present the list of members for selection, code could set all records to 'no' when form opens (or at the end of process when form closes)

    2. filter report by attributes (gender, state, affiliation, etc)

    3. combination of the above

    A parameterized query can be the basis for report RecordSource or code can construct filter string and pass to the report with WHERE CONDITION:

    DoCmd.OpenReport "report name", , , strFilter
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    DepricatedZero's Avatar
    DepricatedZero is offline Cthulhu Fhtagn!
    Windows 8 Access 2007
    Join Date
    Apr 2013
    Location
    Cincinnati
    Posts
    65
    Make sure you put an associated email address in the user table, and then you can call the list of email addresses for each user from a query and concatenate them into a single string, then just put the string in the BCC line.

    Here are some sample functions I use in my code that work similarly

    For these, I first populate a ListBox with a Query of email addresses.

    Code:
    Private Function FetchCustomers(sourceBox As ListBox) As String
        If sourceBox.ListCount > 0 Then
            Dim emails As String
            Dim i As Integer
            For i = 0 To sourceBox.ListCount
                emails = emails & "; " & sourceBox.ItemData(i)
            Next
            
            FetchCustomers = emails
        End If
    End Function
    This returns a String which contains all the entries in the listbox, delimited by a semicolon (

    With that string you could create an outlook item and open it or send it to those emails like so

    Code:
    Dim oApplication As Outlook.Application
    Dim oItem As Outlook.MailItem
    Dim oAccount As Outlook.Accounts
    Dim signature As String
    
    Private Sub SendMail()
       Set oApplication = New Outlook.Application
       Set oItem = oApplication.CreateItemFromTemplate("String Path to an HTML Template for your Email")
       oItem.BCC = FetchCustomers(lstCustomers)
       oItem.Send
    End Sub
    Or you could use oItem.Display to have it pop the email open in outlook so you can validate it before sending.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Creating a rotating Job list
    By brharrii in forum Queries
    Replies: 4
    Last Post: 05-01-2013, 04:07 PM
  2. Access Macro to Clean Up a Mailing List
    By roga789 in forum Access
    Replies: 1
    Last Post: 04-10-2013, 07:08 AM
  3. Replies: 4
    Last Post: 11-06-2012, 12:38 PM
  4. How to setup an e-mailing list?
    By tarhim47 in forum Access
    Replies: 3
    Last Post: 12-06-2011, 07:56 AM
  5. Mailing list question
    By JoeyG54 in forum Access
    Replies: 3
    Last Post: 08-23-2011, 01:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums