Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am having lots of difficulties with the link between MS Access and MS Outlook. Both are at version 2010, I am using the EMailDatabaseObject macro to send a report to a specified email address. It works great, but when I try to run the macro, I get a message stating: "A program is trying to send an e-mail message on your behalf" and asks if I would want to Allow (after 5 seconds of waiting) or Deny.

I've researched into this and realized that it is the Outlook Object Model Guard that is causing this problem. I have configured the Options in both programs, changed the Trust Center for both to Enable all macros, added the Database file location into Access' Trusted Locations, have the "Never warn me about suspicious activity" button checked under Outlook's Programmatic Access, and with all of these set, when I run the macro, it still asks that annoying security warning.

Other solutions show methods of changing the VBA script but I really do not understand or know as to which locations to change what. I've converted my macro to Visual Basic and this is the code:

VB
Option Compare Database

'------------------------------------------------------------
' AutoExec
'
'------------------------------------------------------------
Function AutoExec()
On Error GoTo AutoExec_Err

DoCmd.SendObject acReport, "Campus-Daily-Report", "PDFFormat(*.pdf)", "*To email goes here*", "", "", "Daily Report Test", "Please take a look at the attached.", False, ""


AutoExec_Exit:
Exit Function

AutoExec_Err:
MsgBox Error$
Resume AutoExec_Exit

End Function


I have the macro named AutoExec for the purpose to have the macro run immediately when the file opens.

Please help and let me know what other solutions that I could use for this. If it really requires me to alter the above code, I'm unsure how to change the code for a Macro. I realize that when I converted the macro, it becomes another module that does not work the same way. There are no options in Access to view a Macro's code side.

Any help would be greatly appreciated. I would prefer solutions that would not cost me any $$$, whatever it takes otherwise. Thanks for the help.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900