I have an issue with using an IN keyword in a where cluase of a query. It seems to work if the values I look for are hardcoded but not if I try and take them from a textbox on a form.
If I create a query using an IN keyword in the from with hardcoded sites the query will return data (see QUERY1)
If I create a form (FORM1) with a textbox (TXTWHERE) with the value: "site 1","site2". Then a query to take the value of the textbox (see QUERY2) it returns no rows.
Normally when you use a field in a form and use it in a query it works fine. I think the issue is the query is looking for a value called "form1.txtwhere" not the actual values contained in that textbox. Perhaps there is some sort of string replacement I am not aware of.
Any help on this will be appreciated.
Mark Davies
Warwickshire County Council
If I create a query using an IN keyword in the from with hardcoded sites the query will return data (see QUERY1)
Code:
QUERY1
SELECT * FROM inputdata WHERE sitename in("site 1","site2");
If I create a form (FORM1) with a textbox (TXTWHERE) with the value: "site 1","site2". Then a query to take the value of the textbox (see QUERY2) it returns no rows.
Code:
QUERY2
SELECT * FROM inputdata WHERE sitename in(form1.txtwhere);
Normally when you use a field in a form and use it in a query it works fine. I think the issue is the query is looking for a value called "form1.txtwhere" not the actual values contained in that textbox. Perhaps there is some sort of string replacement I am not aware of.
Any help on this will be appreciated.
Mark Davies
Warwickshire County Council