Results 1 to 2 of 2
  1. #1
    Join Date
    May 2020
    Posts
    26

    Mail merge multi sets of data

    I have a list of suppliers with addresses and I have a query detailing what I have bought from each of the suppliers.



    I want to create letter to each of the suppliers (one each) which includes a list of what I have bought from each one.

    How do I do this?

    It seems something that many people would want to do.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    make a form, and a list box of the clients/emails.
    make a query that uses the selected clientID in the listbox as criteria. like qry
    qsClientPurchases as: select * from table where ClientID = forms!fMyForm!lstBox

    the report would use this query and only report on the 1 client selected in the list box.

    a button on the form can then cycle thru the list of emails and sent them 1 at a time to the chosen client:

    A listbox , lstRpt ,has the reports to pick to print...


    Code:
    sub btnRun_click()
    dim vClientID, vEmail, vSubj, vBody   
    
    vRpt = "rClientReport"
    
    'listbox col1 = clientID, col2= email
    
    
    For i = 0 To lstBox.ListCount - 1
       vClientID= lstBox.ItemData(i)   'get next user in list
       lstBox = vClientID        'set the list
    
    
       vEmail = lstBox.Column(1)   'get the email from the list in column(2), in vb columns begin with zero
       vBody = "body of email"
       vSubj = "your report"
    
    
            'then send the email
         DoCmd.SendObject acSendReport, vRpt, acFormatPDF, vEmail, , , vSubj, vBody   
    Next
    end sub

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

Similar Threads

  1. Mail Merge in Word using Table in Access as Data Source
    By alansidman in forum Import/Export Data
    Replies: 4
    Last Post: 01-08-2019, 03:59 PM
  2. Access to Word mail merge - data format
    By Lex_iuk in forum Import/Export Data
    Replies: 6
    Last Post: 06-24-2015, 06:49 AM
  3. VBA Code for Mail Merge via Dynamic Data Exchange
    By Ganymede in forum Programming
    Replies: 2
    Last Post: 12-28-2011, 05:20 PM
  4. Mail Merge data source queries missing
    By UTS in forum Queries
    Replies: 6
    Last Post: 09-21-2011, 01:48 AM
  5. Mail Merge w/ data from 2 tables
    By sedain121 in forum Import/Export Data
    Replies: 3
    Last Post: 06-30-2010, 09:43 AM

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