cwalker4581
asked on
Run an MS Access macro using an ado connection
Is it possible to run an Access macro inside of excel using an ado connection?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for the reply. if possible i would prefer to do it by ado. I feel that it uses to much overhead to open an access application just to run a macro.
You can access data from Access database using ADO but you won't be able to run macros using ADO.
Not as far as I know.
I think you have to use automation.
Dim objAcc As Access.Application
On Error Resume Next
Set objAcc = GetObject(, "Access.Application") ' if access is open
If Err.Number <> 0 Then
Set objAcc = CreateObject("Access.Appli cation") ' if not..
objAcc.OpenCurrentDatabase "C:\databasename.mdb"
End If
objAcc .docmd.runmacro ("macroname")
I think you have to use automation.
Dim objAcc As Access.Application
On Error Resume Next
Set objAcc = GetObject(, "Access.Application") ' if access is open
If Err.Number <> 0 Then
Set objAcc = CreateObject("Access.Appli
objAcc.OpenCurrentDatabase
End If
objAcc .docmd.runmacro ("macroname")
What does your macro do?
You should be able to run the Access macro by opening the access database in excel and DoCmd.Run command or something like that.