ACC2000: Cannot Use RunCommand acCmdSaveModuleAsText in CodeID: Q200646
|
When you run code that contains the RunCommand method with the acCmdSaveModuleAsText constant, you may receive the following error message:
The command or action 'SaveModuleAsText' isn't available now.
Microsoft Access cannot save a code module while code is running.
You can use the following method to save a code module programmatically:
Option Explicit
Function SaveMod()
DoCmd.OutputTo acOutputModule, "Utility Functions"
End Function
?SaveMod()
Option Explicit
Function SaveModFail()
DoCmd.OpenModule "Utility Functions"
DoCmd.RunCommand acCmdSaveModuleAsText
End Function
?SaveModFail()
Note that you receive the following error message:The command or action 'SaveModuleAsText' isn't available now.
For more information about the OutputTo method, click Microsoft Access Help on the
Help menu, type "OutputTo" in the Office Assistant or the Answer Wizard,
and then click Search to view the topic.
For more information about the RunCommand method, click Microsoft Access Help on the
Help menu, type "RunCommand method" in the Office Assistant or the Answer Wizard,
and then click Search to view the topic.
Additional query words:
Keywords : kberrmsg kbprg MdlOthr PgmObj
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 13, 1999