Hello,
Could someone help me to optimize a simple function
(well, the function's logic is simple, but the optimization might not be simple to find)
Suppose you have
- a table "tblMyTable", with a field called "field1".
- a function to apply to this field.
That is, I want to do:
SELECT myFunction(field1) from MyTable
The problem is that the function is defined by the user.
Before I had something like this:
----------------------------------
Sub myFunction(str as String)
Select Case str
Case A
myFunction = ...
Case B
....
End sub
----------------------------------
Simple, but since the user should be able to easily define the function (without "programming" in VBA ), I switched to:
something like:
---------------------------------------------------------
Sub myFunction(str as String)
myFunction = Dlookup("Result", "tblMyFunction ", "value = '" & str & "'"
End sub
--------------------------------------------------------
That is: the user defines the function through an input form that is bound to the table "tblMyFunction".
This second implementation is damn slow when tblMyTable is big.
Does anybody have an idea for a better implementation
(that still allows the user to easily define the function) ?
Thanks,
Alx
Could someone help me to optimize a simple function
(well, the function's logic is simple, but the optimization might not be simple to find)
Suppose you have
- a table "tblMyTable", with a field called "field1".
- a function to apply to this field.
That is, I want to do:
SELECT myFunction(field1) from MyTable
The problem is that the function is defined by the user.
Before I had something like this:
----------------------------------
Sub myFunction(str as String)
Select Case str
Case A
myFunction = ...
Case B
....
End sub
----------------------------------
Simple, but since the user should be able to easily define the function (without "programming" in VBA ), I switched to:
something like:
---------------------------------------------------------
Sub myFunction(str as String)
myFunction = Dlookup("Result", "tblMyFunction ", "value = '" & str & "'"
End sub
--------------------------------------------------------
That is: the user defines the function through an input form that is bound to the table "tblMyFunction".
This second implementation is damn slow when tblMyTable is big.
Does anybody have an idea for a better implementation
(that still allows the user to easily define the function) ?
Thanks,
Alx