Call a Function via control element in SQL (1 Viewer)

Arvidsson

Registered User.
Local time
Today, 22:49
Joined
Jun 12, 2014
Messages
54
Hello,

is it possible to call a function in a query with the input of a control element?

I have a form, and there is a list box in which I can choose the calculate method. In the query, a field should calculated with the choosen function.

Example:
Code:
SELECT tblTest.price, tblTest.Date, forms![formtest]![lstChosenFunction](tblTest.price, 5) As Calc
...

The function has the same name as I can choose in the listbox. But, if I run the query a error appears.
Code:
"Function forms![formtest]![lstChosenFunction] could not be found"

I would be very glad if someone has an idea how I can call a function in SQL with the input of an listbox.

Thank you very much in advance! :)
 
Last edited:

pr2-eugin

Super Moderator
Local time
Today, 22:49
Joined
Nov 30, 2011
Messages
8,494
It cannot be done as you hoped to do this. I think this would involve created QueryDef object and manipulating the SQL.
 

Arvidsson

Registered User.
Local time
Today, 22:49
Joined
Jun 12, 2014
Messages
54
It cannot be done as you hoped to do this. I think this would involve created QueryDef object and manipulating the SQL.

Can you give me an example how I could do this?
Thank you very much :)
 

Users who are viewing this thread

Top Bottom