[AccessD] Outlook SP3

Christian, Lorraine LChristian at MassMutual.com
Mon Jan 12 05:51:52 CST 2004


Hi - 
I have a 2000 Access database that fires off an automatic email.  Everything was working fine until I upgraded Outlook to SP3.  The code that creates the email message returns this error.

"A program is trying to access e-mail 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"."

There is also a check box on the message that says Allow access for and then you choose the amount of time.

Below is the code I am using: 

Private Sub cmdPositiveEmail_Click() 
    If txtEmailDate.Value <> " " Then 
        MsgBox "Email was already sent on " & Format(txtEmailDate.Value, "mm/dd/yyyy"), vbOKOnly 
    Else 
        Call SendPositiveMessage(False) 
        txtEmailDate.Value = Now() 
        txtTypeOfEmail.Value = "Without Errors" 
    End If 
End Sub 

Private Sub SendPositiveMessage(DisplayMsg As Boolean) 
Dim objOutlook As Object 
Dim objOutlookMsg As Object 
Dim i As Integer 
Dim strTo As String 
Dim strSubject As String 
Dim strBody As String 

On Error GoTo errorhandler 
'On Error Resume Next 
' Create the Outlook session. 
Set objOutlook = CreateObject("Outlook.Application") 

' Create the message. 
Set objOutlookMsg = objOutlook.CreateItem(olMailItem) 

' Retrieves the value from the txtCAName on the form and is assigned 
' to the variable myTo to be used in an Outlook message. 
strTo = Me.txtCAName.Value 

' Retrieves the value from the txtCIPolNo on the form and is assigned 
' to the variable mySubject to be used in an Outlook message. 
strSubject = "Quality Assurance Results: Policy #: " & txtCIPolNo.Value 

' Assigns' variable myBody to be used in an Outlook message. 
strBody = "This case was processed correctly and met all expectations and guidelines." & vbNewLine & vbNewLine & _ 
"Great job!. " 

With objOutlookMsg 
    .To = strTo 
    .Recipients.ResolveAll 
    .Subject = strSubject 
    .Body = strBody 
    .Importance = olImportanceHigh 
    .PrintOut 
    .Send 
End With 

    Set objOutlook = Nothing 
    Set objOutlookMsg = Nothing 
    MsgBox "Message sent successfully...", vbOKOnly, "Email Notification" 
    cmdMainDetail.SetFocus 
    Exit Sub 
    
errorhandler: 
    MsgBox "Outlook could not find sender's name.", vbOKOnly + vbCritical, "Outlook Message" 
    With objOutlookMsg 
        .Display 
    End With 
    Set objOutlook = Nothing 
    Set objOutlookMsg = Nothing 
    MsgBox "Message sent successfully...", vbOKOnly, "Email Notification" 
    cmdMainDetail.SetFocus 
    cmdEmail.Visible = True 
    cmdSend.Visible = False 
    cmdPositiveEmail.ForeColor = vbBlack 
    Exit Sub 
End Sub 

I believe the message is a precaution set up through Microsoft that comes with SP3.  My problem is 
that I have to click this message several times until my code continues to run.  I believe that it is trying to access address book on .resolveall and .send.  Not sure how I can fix this problem.  I can live with clicking "Yes" once, but would like if the message does not appear at all.  Does any one know how to get around this? 

Thanks in advance. 

Lorraine Christian 
MassMutual Financial Group 
New Business Operations 
413.744.5335 
lchristian at massmutual.com 

---------------------------------------------------------
This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. 

---------------------------------------------------------



More information about the AccessD mailing list