Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send Outlook mail from Access with attachment

Status
Not open for further replies.

MacroAlan

Programmer
Joined
Dec 4, 2006
Messages
137
Location
US
Here is what is going on. I use a series of RecordSets to extract certain data that needs to be sent to managers every week. Once compiled, it is going into a TEMP table.

I want to send that temp table as an attachment on an Outlook message. I know I don't have the right syntax for setting the attachment, and have now found the right one.

Code:
            ' once tmpTable filled ~ DO THE EMAIL THING HERE
           Debug.Assert False
           With oMail
       MsgBody = "<p>The attached spreadsheet indicates employees that are indicating unApproved"
       MsgBody = MsgBody & " hours in the period " & Starts & " through " & Ends & ".</p><p>Please review and correct.</p>"
                .BodyFormat = olFormatHTML
                .HTMLBody = MsgBody
                .Subject = "Not Approved hours week ending " & Ends
                .ReminderSet = True
                .Attachments.Add = "tblApprvExport"     'NOT WORKING
                .Recipients = RS!LowestMgrName          'Mgr
                .Recipients.ResolveAll
                .Display = True             'Show email before sending
            End With
NoRecords:
        MgrSet.MoveNext
        Debug.Assert False
    Loop

Am I even close? Do I need to export the table to Excel before attaching? And what would be the syntax then?


Alan
[smurf]
 
Why not simply use the DoCmd.SendObject method ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Because I am thinking too hard and forgot about that method.


Alan
[smurf]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top