Results 1 to 3 of 3
  1. #1
    MSAccessOldTimer is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    46

    Text Field in Email "Subject" Line

    I have a form that is filtered, made into a .pdf, inserted into an Outlook email message, and the subject line and body of the email are started. That all works great and the user can modify the message accordingly based on need before sending the email. The field name is [Associate]. Here is my current code.



    DoCmd.SendObject acSendForm, "frmAssociateTraining", acFormatPDF, _
    "", , , "Safety Training Record for: **enter Associates Name**", "The attachment shows the current safety-related training for the Associate indicated in the email Subject line." _
    & vbCrLf & "Please contact Safety if you have any questions about the information on this record, or if you have the need to schedule training.", True



    I would like to insert the employee (Associates) actual name (based on the filtered results) into the subject line, in place of the **enter Associates Name**. I have tried =[Associate], that did not work. I tried also including the form =[frmAssociateTraining].[Associate], again no luck. It just leaves that same information in the subject line.

    Thanks in advance for any assistance.

  2. #2
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Create strings and use that - it's easier to debug and read as well - you are missing out on concatenating the string values;
    Code:
    Dim sSubject as String
    Dim sMessasge as String
    
    
    sSubject =  "Safety Training Record for: " &  Me.Associate
    sMessage = "The attachment shows the current safety-related training for the Associate indicated in the email Subject line." _
    & vbCrLf & "Please contact Safety if you have any questions about the information on this record, or if you have the need to schedule training."
    
    DoCmd.SendObject acSendForm, "frmAssociateTraining", acFormatPDF, , , , sSubject, sMessage
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    MSAccessOldTimer is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    46
    Minty: thank you so much! That did the trick!!

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

Similar Threads

  1. Replies: 1
    Last Post: 05-17-2018, 09:31 AM
  2. Missing stuff in Email Subject line
    By Thompyt in forum Programming
    Replies: 3
    Last Post: 04-13-2016, 02:26 PM
  3. Replies: 4
    Last Post: 07-12-2014, 02:02 PM
  4. Replies: 3
    Last Post: 04-22-2013, 06:08 AM
  5. VBA check for email subject line
    By problem_addic in forum Access
    Replies: 4
    Last Post: 03-12-2010, 02:33 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