none
Emailing Object Access 2010 RRS feed

  • Question

  • I have created a database quite simply to provide appointment details. I have created a button which opens a new email with the report (appt details) as an attachment. I'm being very lazy here wondering if i can auto insert the clients email address into this email so i can simply hit send and go. The clients email is stored in a table as a hyperlink if this helps.
    Tuesday, December 8, 2015 2:32 AM

Answers

  • >>>I'm being very lazy here wondering if i can auto insert the clients email address into this email so i can simply hit send and go. The clients email is stored in a table as a hyperlink if this helps.

    According to your description, you could refer to below code to get client email in a table, then set MailItem object's To property:

    Dim rs As DAO.Recordset
    Dim db As Database
    Dim strSQL as String
    Dim value as String
    
    
    Set db=CurrentDB
    
    strSQL = "select * from clientmailtable where some condition"
    
    Set rs = db.OpenRecordset(strSQL)
    
    Do While Not rs.EOF
    
       value=rs!SomeField
    
       rs.MoveNext
    
    Loop
    

    For more information, click here to refer about DoCmd.SendObject Method (Access)
    and here to refer about Microsoft Data Access Objects reference

    • Marked as answer by David_JunFeng Friday, December 18, 2015 1:15 AM
    Thursday, December 10, 2015 2:35 AM

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Office, your issue need some VBA code, I'll move your question to the MSDN forum for Access

    http://social.msdn.microsoft.com/Forums/en-US/home?forum=accessdev&filter=alltypes&sort=lastpostdesc

    If you have written the code under the button, please post on this thread. Others will help you easily.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    George Zhao
    TechNet Community Support


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com.
    Wednesday, December 9, 2015 5:40 AM
  • >>>I'm being very lazy here wondering if i can auto insert the clients email address into this email so i can simply hit send and go. The clients email is stored in a table as a hyperlink if this helps.

    According to your description, you could refer to below code to get client email in a table, then set MailItem object's To property:

    Dim rs As DAO.Recordset
    Dim db As Database
    Dim strSQL as String
    Dim value as String
    
    
    Set db=CurrentDB
    
    strSQL = "select * from clientmailtable where some condition"
    
    Set rs = db.OpenRecordset(strSQL)
    
    Do While Not rs.EOF
    
       value=rs!SomeField
    
       rs.MoveNext
    
    Loop
    

    For more information, click here to refer about DoCmd.SendObject Method (Access)
    and here to refer about Microsoft Data Access Objects reference

    • Marked as answer by David_JunFeng Friday, December 18, 2015 1:15 AM
    Thursday, December 10, 2015 2:35 AM