Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does anyone have any experience wit

Status
Not open for further replies.

Page410

Technical User
Mar 9, 2001
106
US
Does anyone have any experience with calling functions from a table? I have a table that contains rules for a process. The table contains a sql statement that is tested and also a yes function field and a no function field.

If the sql statement returns positive then I want to be able to call the function stored in the yes function field. If the sql statement returns negative then I want to be able to call the function stored in the no funciton field.

The problem lies with the passing of parameters for the function. I want to be able to pass parameters from the table as well as the function name. The 'Application.Run' end that I use to run the function from the table requires that parameters be separated by commas(In the code not the field).

It seems that no matter how I store the parameters in the table, I just cannot seem to get my brain around this one.

Even if you cannot provide a solution, any leads would be appreciated.

Thanks in advance
Mike
 
I'm lost. A "Table" will never cause any action to occur in Ms. A. If you are using a table to save small functions as strings where your app retrieves the function from hte table and then 'executes' it, you have ventured into a dark and murky realm. Of course, it CAN be done (at least to some extent), but the questions become myriad and intertwined. A short answer is in an IIF statement combined with the "Eval" function. The longer issue is why do it this way? Simply write the functions and execute them. At worst, write hte functions and save their names in the table and use Eval to to execute them. But, again WHY? What "advantage" is there in saving functions in a table? What is the advantage of saving even the names of the functions in a table?



MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Page,

You're heading towards triggers, I believe. Need to upsize to SQL server or other RDBMS if your goal is to execute code through tables.

Mike Pastore

Hats off to (Roy) Harper
 
The why lies in the flexibility that being able to do this can offer. Running one function that tests conditions in a table and runs functions based on the results of those tests. I am looking to get away from 'hard coding'. I am writing a function that will be able to evaluate data and react to the state of that data and to be able to do it based on data in a table.

The "advantage" is not having to go into and change the code that examines the sql statements every time you have a new test to examine or have one that is no longer being used.

Thinking outside of the box here.

Thank you,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top