• Sending Text To Outlook (Access 2003)

    Author
    Topic
    #424064

    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

    Viewing 0 reply threads
    Author
    Replies
    • #972852

      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.

      • #974480

        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!

        • #974484

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

    Viewing 0 reply threads
    Reply To: Sending Text To Outlook (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: