Call a proc using a string variable for the proc name 
Author Message
 Call a proc using a string variable for the proc name

How can I call a procedure usinga variable for the procedure name?

Private Sub TestProcName ()
    msgbox "It works"
End Sub

Private Sub TestProcName2 ()
    dim str as string
    str = "TestProcName "
    call str
End Sub

Thanks.

--
George Padvorac

nwis.net



Thu, 09 Aug 2001 03:00:00 GMT  
 Call a proc using a string variable for the proc name


Quote:
> How can I call a procedure using a variable for the procedure name?

Use Eval.  This works with a function, so you just need to write a simple
function which calls the procedure.

Slightly convoluted, that's all.

I'd say that the use of Eval should be discouraged, though, in favour of
standard procedure calling which the code editor can perform checks on
during compilation.

--
Paul Bredbury, http://dialspace.dial.pipex.com/brebs/



Thu, 09 Aug 2001 03:00:00 GMT  
 Call a proc using a string variable for the proc name
George,

you can use Run - it's better than Eval in my opinion e.g. because of the
fact that you can use byref and object variables with it etc...

Shamil

--
Shamil Salakhetdinov
DARTS Ltd., St.Petersburg, Russia

URL: http://www.darts.spb.ru


Quote:
>How can I call a procedure usinga variable for the procedure name?

>Private Sub TestProcName ()
>    msgbox "It works"
>End Sub

>Private Sub TestProcName2 ()
>    dim str as string
>    str = "TestProcName "
>    call str
>End Sub

>Thanks.

>--
>George Padvorac

>nwis.net



Thu, 09 Aug 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Same Proc to return Integer or String variable.

2. Same Proc to return Integer or String variable..

3. in-proc vs out-of-proc

4. How to declare variables set in form proc but used after form unloaded

5. How to call the Stored Proc from VB Com object using rdc

6. MDI - Using Proc multiple Children or Multiple Calls

7. Call Let/Get Prop using string variable for name

8. Call Let/Get Prop using string variable for name

9. invalid proc call on repeated application.filesearch.filename call

10. CR8 with stored-proc & passing variable

11. Can ADO2.0 support appendchunk to a Oracle blob variable in a stored proc

12. Use Proc with Static Variables Multiple Times

 

 
Powered by phpBB® Forum Software