Results 1 to 4 of 4
  1. #1
    floyd is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    66

    Add attachment to Outlook Email from Table?

    I have a table: tblDatEmail
    This is where I store all the information I need for outgoing email messages.
    PKEmail - Primary Key

    Second Table: tblDatAttachement
    fkEmail - Foreign Key - to PKEmail
    Attachments - This is a hyperlink field where I store all the locations of the attachments which are tied to the various email

    The form which sends the email is tied to a query called:
    tblDatEmail Query1
    This email has all the above information listed (as well as the other information of course)

    I would like the email to attach the associated file(s) from (tblDatAttachement.Attachments) but no matter what I have tried, I can't seem to get it to work.



    Any help would be greatly appreciated.

    Here is the code I use currently.

    Code:
    Private Sub SecondEmail_Click()
    
    'open Outlook, attach zip folder or file, send e-mail
    Dim appOutLook As OutLook.Application
    Dim MailOutLook As OutLook.MailItem, SaveSig As String
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    MailOutLook.Display
    SaveSig = MailOutLook.HTMLBody
    With MailOutLook
        .BodyFormat = olFormatRichText
        .To = ""
        ''.cc = ""
        ''.bcc = ""
        .Subject = Me.EmailSubjectField
        .HTMLBody = Me.EmailMessageField & SaveSig
        '.Attachments.Add ("path\filename")
        ''.DeleteAfterSubmit = True 'This would let Outlook send the note without storing it in your sent bin
        .Display
        '.Send
    End With
    End Sub

  2. #2
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199
    What the error it throws could you tell?

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    The way I understand it is you have to export the file from the attachment field to a temp folder on your hard drive. Then you have your email code grab the attachment from the temp folder and the kill the temp file.
    There are a couple examples in the form. Here is one
    https://www.accessforums.net/access/...ail-24962.html

  4. #4
    floyd is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    66
    That's all I was able to find as well... (output to computer and attach).

    Surely there has to be an easier way!
    The email signature drove me nuts for DAYS and it was as easy as adding (, SaveSig as string)

    Surely it's something like.... .Attachments.Add (me.attachments)

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

Similar Threads

  1. how do I add the attachment to an email?
    By LanieB in forum Forms
    Replies: 2
    Last Post: 11-01-2013, 10:19 AM
  2. Replies: 5
    Last Post: 10-08-2013, 08:16 AM
  3. Replies: 1
    Last Post: 04-01-2013, 05:00 PM
  4. Send email in Outlook with attachment
    By kelkan in forum Programming
    Replies: 1
    Last Post: 02-01-2013, 10:31 PM
  5. Excel attachment and save as draft in outlook
    By ragsgold in forum Programming
    Replies: 1
    Last Post: 02-01-2013, 05:55 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