Clarify Question 
Author Message
 Clarify Question

my work is unusual and I have built a library of
procedures. I have stored the names of those procedures in
a table, I wish to loop through the table and assign these
procedures to a variable which I can then use to call the
procedure.
I know how to loop through and assign the procedure to the
variable, I'm not sure how then to call the procedure
using the variable

Thanks
Jeff



Sat, 31 Jul 2004 03:24:33 GMT  
 Clarify Question
Try the Eval function.  Example:

Eval("MsgBox(""Hello, world!"")")

Check the help for details.


Quote:
> my work is unusual and I have built a library of
> procedures. I have stored the names of those procedures in
> a table, I wish to loop through the table and assign these
> procedures to a variable which I can then use to call the
> procedure.
> I know how to loop through and assign the procedure to the
> variable, I'm not sure how then to call the procedure
> using the variable

> Thanks
> Jeff



Sat, 31 Jul 2004 03:51:43 GMT  
 Clarify Question
Jeff

Although you can use the eval() function Stan Leszynski suggests in his book
Access97 Expert Solutions the following.

To execute a function whose name is stored in the Argument field of the
table, the Switchboard Manager includes the following line of code in its
forms:

Application.Run rst![Argument]

Note the use of the new Run method to execute a function whose name is
supplied by an expression. This method provides a simple mechanism for
executing a function without storing the function's name in the calling
code. Previously, you used the Eval() function to run a procedure whose name
was supplied as an expression or variable at runtime. Now, you might prefer
to use Run as it is superior to Eval() in the following two ways:

 ? Run enables the referenced procedure to be a Sub procedure, and Eval()
only executes a function procedure.
? You can supply arguments to the Run method that are passed to the called
function by placing them after the function name expression, as in the
following example:

' Pass one argument to the called function

Application.Run strProcName, Me.Name

Christopher



Sat, 31 Jul 2004 06:24:30 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Clarified Question

2. Just to Clarify on that Excel-like question...

3. QueryUnload Cancel Question Clarified

4. Just to Clarify on that Excel-like question...

5. Just to Clarify on that Excel-like question...

6. clarify understanding on redim statement with dynamic arrays

7. db name clarify

8. (repost) Can Microsoft please clarify on the beta?

9. some please clarify what multilingual programming is

10. CLARIFY programming

11. PlaySound: Let me clarify my request

12. Clarified: Automatic Logon

 

 
Powered by phpBB® Forum Software