strantheman
Programmer
I want my query to work for any one of my search forms. Im using 2 variables on my forms to tell the query which column to search by, and where to get the user defined criteria from. theField, and theCriteria
SELECT [itemid], [lastmodified], [accession], [name], [description]
FROM item
WHERE [forms]![searchitem].[theField] Like "*" & [Forms]![searchitem].[theCriteria] & "*"
ORDER BY [forms]![searchitem].[theField] DESC;
How do I get access to evaluate [forms]![searchitem].[theField] as a field name in the table, and not as a string of text? Right now, if theField is "accession" instead of searching through the accession column, it compares the string "accession" to my search criteria.
I hope im being clear. I'd like to think that there's some sort of evaluate() function I can wrap theField in so that access recognizes it as a field in my table and not as a string.
thanks in advance. this will make it so I dont have to write a seperate query for every type of search one might perform.
SELECT [itemid], [lastmodified], [accession], [name], [description]
FROM item
WHERE [forms]![searchitem].[theField] Like "*" & [Forms]![searchitem].[theCriteria] & "*"
ORDER BY [forms]![searchitem].[theField] DESC;
How do I get access to evaluate [forms]![searchitem].[theField] as a field name in the table, and not as a string of text? Right now, if theField is "accession" instead of searching through the accession column, it compares the string "accession" to my search criteria.
I hope im being clear. I'd like to think that there's some sort of evaluate() function I can wrap theField in so that access recognizes it as a field in my table and not as a string.
thanks in advance. this will make it so I dont have to write a seperate query for every type of search one might perform.