on a form in access, I open up a rst and want to send a report to all in a database table list.

It all works and opens outlook and will send it but, it shows the security thing>>>

after I click "allow", it goes ahead and puts the 1st email in "outbox".

then, access moves on the the 2nd report and then , it shows the security thing>>>

after I click "allow", it goes ahead and puts the 2nd email in "outbox".

then, access moves on the the 3rd report and then

etc.. I really don't want the user to have to wait and click this 37 times to complete the task..

I have looked at security on the internet for outlook 2007 but, I can't find anything I can use that works.

I don't want to purchase anything like …..

Advanced Security for Outlook says it will work.. but, I can't get it to do anything..

what can I do.

is there any code I can run in outlook or access 2007 that will let it step thru and send 37 emails to the individuals ??

Dani AI

Generated

The dialog being clicked 37 times is Outlook 2007's programmatic-access guard: Outlook detects an external program (Access) automating mail creation/send and forces user confirmation. is using Access/DoCmd.SendObject which triggers that guard. 's API idea (FindWindow/SendMessage) will work in some cases but is brittle (timing, localization, Outlook updates). pointed to Outlook security settings — those can be changed by an admin, but on many machines the Trust Center option is controlled by Group Policy or by registered antivirus and may be grayed out.

Practical, maintainable fixes (ordered by reliability):

  • Send without Outlook (recommended): export each report to a PDF file (DoCmd.OutputTo) and send via SMTP from Access (CDO or a .NET helper). This completely bypasses Outlook and its prompts; it requires an SMTP server and credentials. Typical flow: export -> attach -> send -> delete temp file.

  • Use a safe Outlook wrapper (common in the field): wrap the Outlook MailItem with a safe library (for example, Redemption.SafeMailItem) so MailItem.Send does not raise the Object Model Guard. This integrates with your existing Outlook automation and avoids per-message prompts. It does add a third-party dependency and may require registration/licensing.

  • Enterprise/admin route: have IT set the programmatic-access policy via Group Policy / Trust Center to allow your signed/trusted automation. This is the correct long-term fix for multi-user environments but needs admin privileges and carries security considerations.

Avoid UI automation hacks except as last resort; they fail on different Windows locales, display scaling, timing, and security updates. Also consider signing the VBA project or moving the send logic into a trusted Outlook add-in (code running inside Outlook is not guarded the same way).

Recommended Answers

All 4 Replies

You might be able to use the following API's in conjunction with your access code.

FindWindow (to find outlook's hwnd)
EnumChildWindows (to find outlooks dialog and to find the ok buttons hwnd)
SendMessage with a WM_BUTTONDOW/WM_BUTTONUP messages to click the button...

There are a few examples out there on all of these api's you will just need to use your friends (yahoo, google, ask, answers, bing).

Good Luck

thanks for the suggestion about api
i don't know how to do it, please show me how to do it..
my code is attached for cmd button
*********

Private Sub Command0_Click()
'MsgBox " ENTERED"
'MsgBox "[Rep EID] =" & [Rep EID]
    Dim rst As Recordset
    Dim strSQL As String
    Dim DBS As Database
    Set DBS = CurrentDb
    'Reps and Mgrs - Comm Named
    strSQL = "SELECT * FROM [Reps and Mgrs - Comm Named]  "  'where [Rep EID]= '20333227'"
    Set rst = DBS.OpenRecordset(strSQL)
    '*******************************8
    rst.MoveFirst
    rst.MoveLast
    'MsgBox " RECORD COUNT IS = " & rst.RecordCount
    rst.MoveFirst
    '**********************************
While (Not (rst.EOF))
    'MsgBox "[Rep EID] = " & rst![Rep EID]
    'MsgBox "Email Address= " & rst![Email Address]
    'MsgBox "FY10 Roster name is = " & rst![FY10 Roster]
    '*********************************
    Me.FilterID = rst![Rep EID]
    'MsgBox " Me.FilterID = " & Me.FilterID
'this opens report for each indivdual
        DoCmd.OpenReport "Acct Notification Letter", acPreview, , "[Rep EID] = [Forms]![FRM_SEND FY10 U S Account Notification report to each]![FilterID]"
'this sends report via outlook for each indivdual
        DoCmd.SendObject acSendReport, "Acct Notification Letter", acFormatPDF, rst![Email Address], , , "Acct Notification Letter for " & rst![FY10 Roster], "Attached is your Account Notification monthly report...", False

'**************************
FindWindow (to find outlook's hwnd)
EnumChildWindows (to find outlooks dialog and to find the ok buttons hwnd)
SendMessage with a WM_BUTTONDOW/WM_BUTTONUP messages to click the button...
'***************************

'this closes the open report for each indivdual

DoCmd.Close acReport, "Acct Notification Letter"
              rst.MoveNext
        Wend
    rst.Close
    DBS.Close
'that's all folks
End Sub

There are a few examples out there on all of these api's you will just need to use your friends (yahoo, google, ask, answers, bing).

You need to set this security settings in outlook 2007.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.