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