473,324 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

running a "variable" function ?

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
4 1754
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
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
<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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: elektrophyte | last post by:
I was looking at the PHP function "call_user_func()" (http://us3.php.net/call_user_func). It appears that this will solve a design problem in the app I'm working on. (I'm writing a class that will...
1
by: sindre hiåsen | last post by:
Hi, I need a way to save a variable in a function. I want to do something like this. On functioncall set a variable and another function call gets the variable set by the other function call....
2
by: K Williams | last post by:
I recently discovered that you can do the following: if currentdb.openrecordset ("select statement.....").eof = true then for cases when you just want to see if any records exist. This...
7
by: ben | last post by:
hello, an algorithm book i'm reading talks about the connectivity problem/algorithm. it gives a number of examples where the connectivity problem applies to real life situations (like, the...
3
by: Zeljko | last post by:
Hi, Is there a way to define a local variable that retains it's value between the function calls ? Zeljko
4
by: Friday | last post by:
Being an Old L.A.M.P guy, I beg you to please excuse my ignorance of dot.net (and all things Windows, for that matter). As part of an experiment (to learn enough ASP/VB.net to port a series of ...
4
by: octavio | last post by:
Hello members of the comp.lang.c newsgroup. Please I need you help on the following one. Compiling the simple code I'm getting this error message. Why ? Please what's the correct type of the fb...
6
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why doesn't the global variable "divId" always refer to the element with id="divId"?...
11
by: gg9h0st | last post by:
i saw a code refactorying onload event listener window.onloadListeners=new Array(); window.addOnLoadListener=function(listener) { window.onloadListeners=listener; } why declare the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.