Calling SubProcedure

PearlGI

Registered User.
Local time
Today, 05:50
Joined
Aug 30, 2001
Messages
125
This isn't as straightforward as the title suggests!

Does anyone know of a way to call a procedure by using a variable that contains the procedure name rather just typing the procedure name into the code.

For example, if I wish to run a procedure called 'Calc', usually you would just type

Calc

into the code and the procedure would run, however in my situation I don't know the name of the procedure, this is to be passed to the code as a parameter. Therefore, I'm looking for something like

strCode = "Calc"
...
...
RunCode strCode


I've tried looking at the DoCmd functions, but DoCmd.OpenModule just displays the code and doesn't run it.

Any suggestions?
 
Lookup in the Knowledge Base or your Access Help files the "Eval Function"

This will do what you are asking.
 
Use the Run method of the Application object to launch the procedure. The Run method takes a string argument containing the name of the procedure to be executed.
 
Just when you give up hope, along come 2 solutions at once.

Many, many thanks :)
 

Users who are viewing this thread

Back
Top Bottom