Results 1 to 5 of 5
  1. #1
    Join Date
    May 2014
    Posts
    98

    Answered: How to avoid security warning when an automatic email is sent from the access?

    I have a "recognition database". Every time one person recognize another person. The person chooses other person's name in the drop down and when that record is saved an email should be sent to the person to let him know that recognition for him has been submitted in the database. I am using the code below it works fine and it send email but gives me a security warnings every time an automatic email is sent. It will be pain if everyone has to select "Allow" everytime. So I do not want to have that popup. Please check my code and suggest how I can avoid that security popup.

    Private Sub Label140_Click()On Error Resume Next
    Dim Combo97 As String
    Dim stText96 As String




    If IsNull(Me![Combo97]) Then
    MsgBox "You must read the Recognition.", vbOKOnly, "More Data Required!"
    Exit Sub
    End If


    RunCommand acCmdSaveRecord
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Me.Refresh
    Me.Dirty = False
    Dim oApp As Outlook.Application
    Dim oMail As MailItem
    Set oApp = CreateObject("Outlook.application")


    Set oMail = oApp.CreateItem(olMailItem)


    stText96 = Format(Me.Text96, "00000")

    oMail.HTMLBody = "A Recognition has been submitted for you in the Recognition database. Please address this Recognition.." & Chr$(13) & _
    Chr$(13) & "Recognition Number: " & stText96 & Chr$(13) & "" & Chr$(13) & _
    Chr$(13) & "Below is the link to the database... " & Chr$(13) & _
    Chr$(13) & "<a href=""" & "C:\Recognition - Front End.mde" & """>" & "C:\Recognition- Front End.mde" & "</a > " & Chr$(13) & _
    Chr$(13) & "***THIS IS A SYSTEM GENERATED EMAIL. PLEASE DO NOT REPLY TO THIS EMAIL****."

    oMail.Subject = "You have received a new Recognition."
    oMail.To = Forms![New Recognition]!Combo97
    oMail.CC = ""
    oMail.Send
    Set oMail = Nothing
    Set oApp = Nothing


    DoCmd.GoToRecord , , acNewRec
    'DoCmd.Close acForm, NewRecognition, acSaveYes
    'Exit_addNewRecord_Click:
    ' Exit Sub
    'Err_addNewRecord_Click:
    ' MsgBox Err.Description
    ' Resume Exit_addNewRecord_Click


    End Sub
    The popup I receive is as follows.Click image for larger version. 

Name:	Capture.PNG 
Views:	3 
Size:	14.1 KB 
ID:	16894
    Last edited by jj2; 05-15-16 at 11:50.

  2. Best Answer
    Posted by healdem

    "Use the set warnings macro
    Code:
    set warnings off
    'Do stuff
    Set warnings on
    "


  3. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Use the set warnings macro
    Code:
    set warnings off
    'Do stuff
    Set warnings on
    I'd rather be riding on the Tiger 800 or the Norton

  4. #3
    Join Date
    May 2014
    Posts
    98
    Thanks for quick reply... In the code where should I add warning off code

  5. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    As post #2 suggests
    Turn the warnings off
    Do stuff
    Then turn warnings back on.

    Find ehag part of YOUR code throws the warning message and then cintrol that....
    I'd rather be riding on the Tiger 800 or the Norton

  6. #5
    Join Date
    Dec 2004
    Posts
    36
    I believe this warning is from MS Exchange.
    Last edited by Reg; 05-20-16 at 17:58. Reason: misspoke

Posting Permissions

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