Solved

Why do I get a clean email generated with an ADP file using SQL Server and when I use the same code with an MDB file I get a warning ?

Posted on 2008-06-09
1
313 Views
Last Modified: 2008-06-10
I am developing an Access 2003 application using an MDB file. In this application I am attempting to generate emails.

Why do I get a clean email generated with an ADP file using SQL Server and when I use the same code with an MDB file I get the warning as follows:

Microsoft Office Outlook.
A program is trying to access email addresses you have stored in outlook. Do you want to allow this ?
If this is unexpected, it may be a virus and you should choose "No".

allow access for
Yes     No     Help

How can I eliminate this warning message from appearing when I generate an email from my MDB file ?



My code is in the attached code snippet.
Private Sub Command591_Click()
  Dim rsList As ADODB.Recordset
  Dim rsBranch As ADODB.Recordset
  Dim cn As ADODB.Connection
  Dim cn2 As ADODB.Connection
  Dim iMsg As Object
  Dim iConf As Object
  Dim Flds As Object
  Dim strTo, strCC, strBCC, strFrom, strSub, strFile, strBody, strBank As String
  Dim strBankName
  Dim strSQL As String
  
  strBankName = "BONY"
  Set rsList = New ADODB.Recordset
  Set rsList = New ADODB.Recordset
  Set rsBranch = New ADODB.Recordset
  Set cn = CurrentProject.Connection
  Set cn2 = CurrentProject.Connection
  Set iMsg = CreateObject("CDO.Message")
  Set iConf = CreateObject("CDO.Configuration")
  Set Flds = iConf.Fields
  With Flds
       .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
       .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mta-hub.ms.com"
       .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 76
       .Update
  End With
  DoCmd.Hourglass True
  With rsList
    'strSQL = "SELECT bankEmail, toEmail, ccEmail, bccEmail, fromEmail, subEmail, fileEmail, bodyEmail from tblEmail where bankEmail = " & "'" & strBankName & "'"
    .Open "SELECT bankEmail, toEmail, ccEmail, bccEmail, fromEmail, subEmail, fileEmail, bodyEmail from tblEmail where bankEmail = " & "'" & strBankName & "'", cn, 2, 2
    strBank = .Fields("bankEmail")
    strTo = .Fields("toEmail")
    strCC = .Fields("ccEmail")
    strBCC = .Fields("bccEmail")
    strFrom = .Fields("fromEmail")
    strSub = .Fields("subEmail")
    strFile = .Fields("fileEmail")
    strBody = .Fields("bodyEMail")
    Set iMsg = CreateObject("CDO.Message")
    With iMsg
       Set .Configuration = iConf
       .To = "john.zimmerman@mo.org"
       .From = "john.zimmerman@mo.org"
       .Subject = strBankName
       .Send
       DoCmd.Hourglass False
       MsgBox "An email was sent for  ", vbOKOnly, "Email Sent"
    End With
  End With
End Sub

Open in new window

0
Comment
Question by:zimmer9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
slamhound earned 500 total points
ID: 21748591
This is simply a security feature from Microsoft. The best way I've found around it is a 3rd party program called Click Yes http://www.contextmagic.com/ This doesn't mess with anyone's code or security settings but simply answers "Yes" to that annoying message.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access 2010 7 46
MS Access Combobox to Disable Controls on a Separate Form 10 26
Access Report formatting issue 5 22
Auto BCC 8 27
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question