By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,504 Members | 2,606 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,504 IT Pros & Developers. It's quick & easy.

running a "variable" function ?

P: n/a
Hi

May i know is it possible to run a function when we pass in the
function name as parameter ?

eg retval = functionA(A)

but i would like to have something like :

varFun = functionA(A)
retval = varFun

varFun = functionB(B)
retval = varFun

varFun = functionC(C)
retval = varFun

the reason is becuase i am thinking of storing the function names in a
database field so that based on what is selected, i will run that
function. so in a way, the which function to run is a "variable"

for some advice please
Thank you
Boon Yiang

Jan 5 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Check VBA Help for the "eval" function.

That said, there's (almost?) always some better way to accomplish a given
purpose than relying on saving function names and using them in this manner.

Larry Linson
Microsoft Access MVP

<ch****@hotmail.comwrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
Hi

May i know is it possible to run a function when we pass in the
function name as parameter ?

eg retval = functionA(A)

but i would like to have something like :

varFun = functionA(A)
retval = varFun

varFun = functionB(B)
retval = varFun

varFun = functionC(C)
retval = varFun

the reason is becuase i am thinking of storing the function names in a
database field so that based on what is selected, i will run that
function. so in a way, the which function to run is a "variable"

for some advice please
Thank you
Boon Yiang

Jan 5 '07 #2

P: n/a
Dear Larry

thank you very much for the information. I agree with you that there
are better ways to accomplish this. What i have is a generic input box
for any kinds of data. so i need to define the different functions to
validate the data after the user has defined the questions they want to
capture. This will allow flexibility and mini maintenance from IT.
That's one way i feel i could do.

Best Regards
Boon Yiang

Larry Linson wrote:
Check VBA Help for the "eval" function.

That said, there's (almost?) always some better way to accomplish a given
purpose than relying on saving function names and using them in this manner.

Larry Linson
Microsoft Access MVP

<ch****@hotmail.comwrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
Hi

May i know is it possible to run a function when we pass in the
function name as parameter ?

eg retval = functionA(A)

but i would like to have something like :

varFun = functionA(A)
retval = varFun

varFun = functionB(B)
retval = varFun

varFun = functionC(C)
retval = varFun

the reason is becuase i am thinking of storing the function names in a
database field so that based on what is selected, i will run that
function. so in a way, the which function to run is a "variable"

for some advice please
Thank you
Boon Yiang
Jan 5 '07 #3

P: n/a
<ch****@hotmail.comwrote in message
news:11*********************@s34g2000cwa.googlegro ups.com...
Dear Larry

thank you very much for the information. I agree with you that there
are better ways to accomplish this. What i have is a generic input box
for any kinds of data. so i need to define the different functions to
validate the data after the user has defined the questions they want to
capture. This will allow flexibility and mini maintenance from IT.
That's one way i feel i could do.

Best Regards
Boon Yiang

Larry Linson wrote:
>Check VBA Help for the "eval" function.

That said, there's (almost?) always some better way to accomplish a given
purpose than relying on saving function names and using them in this
manner.

Larry Linson
Microsoft Access MVP

<ch****@hotmail.comwrote in message
news:11**********************@38g2000cwa.googlegr oups.com...
Hi

May i know is it possible to run a function when we pass in the
function name as parameter ?

eg retval = functionA(A)

but i would like to have something like :

varFun = functionA(A)
retval = varFun

varFun = functionB(B)
retval = varFun

varFun = functionC(C)
retval = varFun

the reason is becuase i am thinking of storing the function names in a
database field so that based on what is selected, i will run that
function. so in a way, the which function to run is a "variable"

for some advice please
Thank you
Boon Yiang

Jan 5 '07 #4

P: n/a
Sorry for the empty response. I was going to say that, not knowing your
environment, your application requirements, or your level of experience with
Access, I am not in a position to offer suggestions for alternatives.

I haven't ever, as far as I recall, used an Input Box in a developed
database application; I use Forms for user data entry, with event code as
needed. I am not certain why anyone would use a "generic Input Box", nor,
exactly, what that means.

Good luck with your application.

Larry Linson
Microsoft Access MVP


Jan 6 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.