Running a module from a macro?

dcarr

Trainee Database Analyst
Local time
Today, 01:53
Joined
Jun 19, 2002
Messages
112
Is it possible to run a module from within a macro? I have created several module and wanted to run them from within a single module. I have tried using 'OpenModule' but this simply shows the syntax? Is there anyway I can execute a module from within a macro? If there is does anyone know the function I should use?
Thanks guys
 
You can't necessarily run the whole module, but you can run functions from the module. Use the runcode command in the macro and then type your function name where specified.
 
Thanks that worked great
 
You can not "run" a module, since it is only a container for funcs and subs. Note that only public funcs and subs can be executed from the outside and that form and report modules can not contain public funcs and subs.

Here an interesting article from the AOE (www.unsoftwareag.com):

ACCESS ONLINE ENCYCLOPEDIA Article Code: G2

Why should you avoid MACROS ?
Macros have been a great invention back in 1987. In simply recording the operations on the screen any user could create his own little programs and modify them later on.
They are ideal if you just need one functionality and if you do not want to create a real application.
Nethertheless the creation of macros requires time and effort and there is a great chance that all this investment will be lost very soon.
The reasons are multiple:

Macros do not allow any error trapping
Macros can not be debugged
Macros can not be converted in VBA code
Macros are inflexible
Macros are not protected in MDE files
Related topics in the USA ACCESS ENCYCLOPEDIA:
All articles in the MODULES AND VBA section.

Exceptions from the rule

The AUTOEXEC macro will be executed automatically on opening your application
The AUTOKEYS macro can check the function keys throughout the whole application
 
In reply to the article from ElsVanMiert

There is one factual error in the material quoted. It is possible to manually convert a macro into code. That has been possible at least since AC97 came out. It is a menu bar option on the Macros pane of the Access window.

File>>Save As...

Then select the "Save as Visual Basic Module" radio button and click OK.

I don't disagree with anything else in the article.
 

Users who are viewing this thread

Back
Top Bottom