我已经写了一些SQL查询,一些子程序,有一定的保存进口。
I have written some sql queries, some sub procedures and have some saved imports.
现在我想使用在Access中宏的设计,以提供一个运行按钮,将顺序运行这些对象。
Now I am trying to use the Macro Design in Access to provide a run button which will run these objects sequentially.
不过,我没有看到任何命令运行Sun的程序,我可以看到OpenVisualBasicModule和运行code。
However I dont see any command for running a sun procedure, I can see OpenVisualBasicModule and Runcode.
OpenVisualBaicModule只打开我的子过程,以及运行code是要求只有一个功能。
OpenVisualBaicModule is only opening my sub procedures and Run Code is asking for a function only.
我创建了所有的子过程调用里面的函数。但是,多数民众赞成在不工作时单独所有这些工作。
I created a function with all the sub procedure call inside. But thats not working while individually all of them work.
任何建议怎么做。
请确保您的VBA code被放置在函数内部(没有一分,这是行不通的)。 创建您的功能,如:
Make sure your VBA code is placed inside a Function (not a SUB, that won't work). Create your function like:
Function DoSomething()
'Do your stuff
End Function
或者,如果你想执行一个子,只需创建一个函数来调用你的子,这样的:
Or if you want to execute a Sub, just create a Function that calls your sub, like:
Function DoSomething()
Call YourSub()
End Function
在宏设计,添加了运行code'行动(宏命令>运行code)和调用函数:
Inside the Macro Design, add the 'RunCode' action (Macro Commands > RunCode) and call your function:
DoSomething()
瞧,就大功告成了。
And voila, you're done.