Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sending Text To Outlook (Access 2003)

    I'm having a problem sending some data to the body of an Outlook message.

    I currently have a form (F_Shortages) that when I click button it opens and displays an email with all information associated with the shortage (see attachement). I have this setup working perfectly, but what I also need to include is data from the subform (FS_PO). Being a novice user of VB, I'm not able to accomplish this on my own. I've tried to do this with setting up a recordset and SQL, but I keep getting errors (my own ignorance). Can someone please help?

    Please also note that I want this imbedded into the email message. This is the reason why I didn't use SendObject.

    Thanks in advance,
    Drew

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sending Text To Outlook (Access 2003)

    Since you haven't provided much information, I have made up some code. You will have to adapt it to your situation. In the attached text file,

    tblSomething = name of the table that acts as record source of the subform (it can be a query)
    ID = field linking main form and subform. I have assumed that it is a number field.
    ThisField, ThatField: fields from the table that you want to be included in the e-mail.

    I have added error handling - this is essential if you use Automation.

    You must have a reference to the Microsoft DAO 3.6 Object Library (in Tools | References...) for the code to run.

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sending Text To Outlook (Access 2003)

    Hans,

    Sorry for the late reply. I've been very busy.

    To be more specific, the tables that I'm retrieving information from are called T_Shortage and T_PO, with multiple T_PO records per T_Shortage record.
    The fields that I use for this email are setup as follows...
    ---Table T_Shortage...
    Shortage_ID = Text
    Item_ID = Text
    SDesc = Text
    LDesc = Text
    ---Table T_PO...
    PO = Text
    Qty = Number
    Due_Dt = Date

    I've had a little help from a person here to setup this code (see attached code). He is far from an expert, but we got it to work (I've added your error handling).
    I see that you have much less code that does the same thing. Would it be to my advantage to use your code or stick with what I already have?
    Thanks!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sending Text To Outlook (Access 2003)

    The code you have is basically equivalent to what I posted, so if it works, I would stick with it.

Posting Permissions

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