M
Michael Ryle
Hi All,
I'm using the following Outlook macro code to run a query in MS Access whenever a calendar item (appointment) is added in Outlook:
Public WithEvents myOlItems As Outlook.Items
Private Sub Application_Startup()
Set myOlItems = _
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
Dim appAccess As Access.Application
...
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "... my database path ..."
appAccess.DoCmd.RunSQL ("... my query ...")
appAccess.CloseCurrentDatabase
appAccess.Quit
End Sub
The problem I have is that when this code runs it causes the MS Access window to flash on and off, which is confusing and annoying to the user.
Is there are way of running an MS Access query from Outlook "in background", i.e., without causing the MS Access window to flash? Thanks.
I'm using the following Outlook macro code to run a query in MS Access whenever a calendar item (appointment) is added in Outlook:
Public WithEvents myOlItems As Outlook.Items
Private Sub Application_Startup()
Set myOlItems = _
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
Dim appAccess As Access.Application
...
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "... my database path ..."
appAccess.DoCmd.RunSQL ("... my query ...")
appAccess.CloseCurrentDatabase
appAccess.Quit
End Sub
The problem I have is that when this code runs it causes the MS Access window to flash on and off, which is confusing and annoying to the user.
Is there are way of running an MS Access query from Outlook "in background", i.e., without causing the MS Access window to flash? Thanks.