Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2013
    Posts
    2

    Exclamation Unanswered: Send eMail Via Access

    Need help disabling outlook security warning?

  2. #2
    Join Date
    Jan 2013
    Posts
    2
    Hi I am new to access and VBA,

    I have the following code below and it works to send an email. I am unable to get rid of outlooks security warning. Also could anyone take a look at the code below and correct any other mistakes that my be in there would be appreciated.

    Private Sub email_DblClick(Cancel As Integer)
    On Error GoTo Email_Err

    Dim myOlApp As Object
    Dim myItem As Object
    'Dim myAttachments, myRecipient As Object
    Dim recipient As String
    Dim mySubject As Object
    Dim dbs As Object

    Set dbs = CurrentDb


    recipient = Me![email]
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olMailItem)
    'Set myAttachments = myItem.Attachments
    Set myRecipient = myItem.Recipients.Add(recipient)
    myItem.Subject = "Delivery"
    myItem.Display
    myItem.HTMLBody = "Con Number: " & [Delivery Items subform1].Form![stext] & "<br>Item: " & [Delivery Items subform1].Form![item] & "<br>Number of items: " & [Delivery Items subform1].Form![number] & "<br>Courier: " & [Delivery Items subform1].Form![Courier] & "<br>" & "<br>" & "Hi " & Me.fname & "," & "<br><br>" & "I'm just sending an email to let you know that a delivery has arrived at the B3 Store." & "<br>" & "This can be picked up any time between 7am - 4pm weekdays." & "<br><br>" & "If you require any information regarding this delivery, please don't hesitate to contact me." & "<br><br>" & "Kind Regards," & myItem.HTMLBody

    'Cleanup
    Set myRecipient = Nothing
    'Set myAttachments = Nothing
    Set myItem = Nothing
    Set myOlApp = Nothing

    Email_Exit:
    Exit Sub

    Email_Err:
    MsgBox Err.Description
    Resume Email_Exit
    'Application.FollowHyperlink "mailto:" & Me![email]
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •