Working access DB with code like:
This code is called by a Macro that says
Calling it from outside, using
worked fine.
But then, I had to replace Sub2 with an SQL script.
I tested running the script by itself and it worked.
So I created Func_A to call Sub1 and Func_B to call
Sub3. Made two copies of the macro, Mac_A and Mac_B
and changed the function names accordingly. Changed
the outside code to
At the second line I get an exception with the message
"The RunMacro action was canceled."
I removed the Quit (which I should have done first)
but got the same thing. I put a Stop at the beginning
of Sub1 and stepped through it. All statements ran the
same as always, but when I stepped "into" the end
statement, I got the same exception in the outside
routine.
???
--
Wes Groleau
Code:
Function Func_All
Call Sub1
Call Sub2
Call Sub3
end function
Code:
Warnings Off
RunCode Func_All
Warnings On
Quit
Calling it from outside, using
Code:
MDB.OpenCurrentDatabase(Access_DB)
MDB.DoCmd.RunMacro("Mac_All")
But then, I had to replace Sub2 with an SQL script.
I tested running the script by itself and it worked.
So I created Func_A to call Sub1 and Func_B to call
Sub3. Made two copies of the macro, Mac_A and Mac_B
and changed the function names accordingly. Changed
the outside code to
Code:
MDB.OpenCurrentDatabase(Access_DB)
MDB.DoCmd.RunMacro("Mac_A")
SQL_Script(<filename>)
MDB.DoCmd.RunMacro("Mac_B")
"The RunMacro action was canceled."
I removed the Quit (which I should have done first)
but got the same thing. I put a Stop at the beginning
of Sub1 and stepped through it. All statements ran the
same as always, but when I stepped "into" the end
statement, I got the same exception in the outside
routine.
???
--
Wes Groleau