Results 1 to 3 of 3
  1. #1
    Wernich is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2016
    Location
    Johannesburg
    Posts
    2

    Mail report in Access

    Hi, I am able to mail a report in access to multiple receptions via Marcos. I want to mail specific parts of the report to specific people, every header with data to a person, and so on.



    Can anybody assist with the code ordirections.

    Thank you

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    create a form, frmRpts.
    on the form is a list box of all userID, emails. lstEmails (Username is col1, email addr is col2.)
    put a button on the form, btnSend, to cycle thru the list sending the report.

    select a user in the list box.
    Build a query to look at this item in the list and show ONLY their data.
    ie: select * from data where [userid] = forms!frmRpts!lstEmails
    this query is what the report uses. NOTE: in vb code, col 1 starts with 0, etc.

    user clicks button to send all reports:
    Code:
    sub btnSend_click()
         'scan the list box
    For i = 0 To lstEmails.ListCount - 1
       vTo = lstEmails.Column(1)
         
       DoCmd.SendObject acSendReport, vRpt, acFormatPDF, vTO, , , vSubj, vBody
    Next
    End Sub

  3. #3
    Wernich is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2016
    Location
    Johannesburg
    Posts
    2

    Thanks, I will give it it try

    Quote Originally Posted by ranman256 View Post
    create a form, frmRpts.
    on the form is a list box of all userID, emails. lstEmails (Username is col1, email addr is col2.)
    put a button on the form, btnSend, to cycle thru the list sending the report.

    select a user in the list box.
    Build a query to look at this item in the list and show ONLY their data.
    ie: select * from data where [userid] = forms!frmRpts!lstEmails
    this query is what the report uses. NOTE: in vb code, col 1 starts with 0, etc.

    user clicks button to send all reports:
    Code:
    sub btnSend_click()
         'scan the list box
    For i = 0 To lstEmails.ListCount - 1
       vTo = lstEmails.Column(1)
         
       DoCmd.SendObject acSendReport, vRpt, acFormatPDF, vTO, , , vSubj, vBody
    Next
    End Sub


    Thanks will give it a try

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

Similar Threads

  1. Replies: 4
    Last Post: 09-20-2012, 04:01 PM
  2. Replies: 1
    Last Post: 09-14-2012, 10:27 AM
  3. Send e-mail with info from Report
    By mari_hitz in forum Import/Export Data
    Replies: 22
    Last Post: 12-17-2011, 06:24 PM
  4. E-mail Selective Report
    By adams.bria in forum Reports
    Replies: 1
    Last Post: 10-25-2011, 12:29 PM
  5. acces listbox hatası(acces debug)
    By carso in forum Access
    Replies: 1
    Last Post: 09-22-2009, 04:11 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