locked
Working with MS Access Attachments RRS feed

  • Question

  • I have a Database that stores files in the "Attachment" field.  and I have a button on a form that generates an email to send to a recipient that can include a file if I specify a path. (eg. "c:\sample.txt").  However what I really want to do is attach all the files I have for the given record to the email. 

    I can't seem to find any documentation on how to get the file path of the attchament, OR how to get MS Access to attach the contects of the field to my outlook email.

    I am more of a hack than a programmer so please don't laugh to hard when you see my code ;)

    The below code works because it has a hard path to the file, but I ultimately want to pull the files from the field where I am storing them.

    Set oLapp = CreateObject("Outlook.application")
    Set oItem = oLapp.CreateItem(0)

    With oItem
       .Subject = "Sourced candidate for " & strNumb & " " & strPos
       .To = strRecipient
       .Body = strMessage
       Set oAttach1 = .Attachments.Add("C:\Files\" & strNumb & "\" & strCanFN & " " & strCanLN & ".docx")
       .Display
    End With

    Set oLapp = Nothing
    Set oItem = Nothing

     

    Can anyone please help me?

    Friday, August 19, 2011 11:16 PM

All replies