Hello
I have two databases,1and 2,I want to run a macro from database 2 in database 1 :
I have the below code, but not work and no error .can you hint where is the issue?
Public Function run_main()
Call CallMacro()
End Function
Public Sub CallMacro()
'
Dim strDbName, strMacro
Dim objApp
'
strDbName = "*****.accdb"
strMacro = "Main"
'
Set objApp = CreateObject("Access.Application")
'
objApp.OpenCurrentDatabase strDbName
'
' Run Macro:
'
objApp.DoCmd.RunMacro strMacro
'
objApp.Quit
Set objApp = Nothing
'
End Sub
I have two databases,1and 2,I want to run a macro from database 2 in database 1 :
I have the below code, but not work and no error .can you hint where is the issue?
Public Function run_main()
Call CallMacro()
End Function
Public Sub CallMacro()
'
Dim strDbName, strMacro
Dim objApp
'
strDbName = "*****.accdb"
strMacro = "Main"
'
Set objApp = CreateObject("Access.Application")
'
objApp.OpenCurrentDatabase strDbName
'
' Run Macro:
'
objApp.DoCmd.RunMacro strMacro
'
objApp.Quit
Set objApp = Nothing
'
End Sub