Hi
I am wondering if anyone can tell me why this form opens 2 emails?
It creates the email addressed, with subject, with content and attachment and then it opens a blank new email.
I didn't write it but I have been asked to fix it and I am new to Access.
Any help appreciated.
Regards.
Code:
Private Sub cmdemail_Click()
On Error GoTo HandleErr:
Dim myOlApp As Outlook.Application
Dim MyItem As Outlook.MailItem
Dim strSal As String, strName As String, strOFT As String
strOFT = "\\CGICSVR\Public\BOP\BOPEmail1.oft"
strName = "Dear " & Me!GivenName
strSal = "<p><font face='Verdana, Arial, Helvetica, sans-serif'>" & strName & ",</font></p>"
Set myOlApp = CreateObject("Outlook.Application")
Set MyItem = myOlApp.CreateItemFromTemplate(strOFT)
MyItem.To = Me!EmailAddress
MyItem.Attachments.Add "\\CGICSVR\Public\BOP\Bank On Property.pdf"
MyItem.HTMLBody = strSal & MyItem.HTMLBody
MyItem.Display
'MyItem.Send
Me!DateSent = Format(Now, "Short Date")
Me!Method = "Email"
ExitHere:
Exit Sub
HandleErr:
MsgBox Err & ": " & Err.Description
Resume ExitHere
End Sub