Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    139

    Unanswered: Populating Sub line in SendObject email

    Hi - I have been sending an Access report to our Customer using the SendObject function in a macro. This has been working fine but the customer has asked that we put the PO# from the report in the subject line of the email. Is there anyway to have the report open and then reference a piece of data??

    Any suggestions would be appreciated!

    Thanks,
    B&R

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    In a place before your docmd.SendObject, you could try dimensioning a variable and set that variable = "PO Number: " & Reports!MyReportName!PONumField and use that variable in the subject parameter for the docmd.SendObject (or just reference Reports!MyReportName!PONumField itself in the subject parameter for the docmd.sendobject command.)

    If the report's not open or this doesn't work, try grabbing the PO # from the form or any place else where it might be visible (i.e. as a dlookup against the query for the report.)
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5

    if you are using outlook here is snippett that you can use

    This is my own personal sendmessage code I have used for over 5 years

    I have left out some things

    make sure you have a reference to the outlook object model in tools references
    Code:
    Dim objOutlook As Outlook.Application
    Set objOutlook = New Outlook.Application
    
    
       Dim objOutlookMsg As Outlook.MailItem
       Dim objOutlookRecip As Outlook.Recipient
       Dim objOutlookAttach As Outlook.Attachment
       Dim strconemail As String
      
         Set objOutlook = CreateObject("Outlook.Application")
    
            
            Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
    
            With objOutlookMsg
            
            Set objOutlookRecip = .Recipients.Add(bob@mydomain.com) 'example
            objOutlookRecip.Type = olTo
           dim mysubject as string 
    	mysubject = "This is a subject test"
            .Subject = mysubject
     
            .Body = "This goes in the body"
            .Importance = olImportanceHigh  'High importance
            
          
             Set objOutlookAttach = .Attachments.Add(anypathhere) 'example
           
            .Send
    
            End With
       
    Set objOutlookMsg = Nothing
    Set objOutlook = Nothing
    Last edited by gvee; 10-30-07 at 18:53. Reason: [CODE] tags added to retain formatting and read-ability
    Dale Houston, TX

  4. #4
    Join Date
    Feb 2004
    Posts
    139
    Works great! Thanks for the help.

    B&R

  5. #5
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    Nice to know I could help - I have been suffering from a low self-esteem lately because I thought I was mis-interpreting user requests.



    Have a good day
    Dale Houston, TX

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •