AHEC
asked on
Call MSACCESS function from Outlook
I have code to call an Access function from Outlook when a new mail item is added to a specific folder. The Access database is always open when Outlook is open.
In ThisOutlookSession I have
In Access I have
When I first test the code it runs fine, but if I go back later and try it I get a 7952 "You have made an illegal function call" in Outlook at
I can't figure out why it runs OK if I redo it, but then starts giving the error again after a while.
In ThisOutlookSession I have
Public WithEvents myOlItems As Outlook.Items
Public Sub Application_Startup()
Set myOlItems = Application.GetNamespace("Mapi").Folders("Mailbox - Media Center").Folders("Inbox").Folders("Accepted Calls").Items
End Sub
Public Sub myOlItems_ItemAdd(ByVal Item As Object)
Dim acApp As Access.Application
Set acApp = GetObject(, "Access.Application")
acApp.Application.Run ("Out_Check")
End Sub
In Access I have
Public Sub Out_Check()
Call Forms("Enter Calls").Check_Mail_Click
End Sub
When I first test the code it runs fine, but if I go back later and try it I get a 7952 "You have made an illegal function call" in Outlook at
acApp.Application.Run ("Out_Check")
I can't figure out why it runs OK if I redo it, but then starts giving the error again after a while.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER