Select query fields from combo box

UniqueTII

What?
Local time
Today, 17:12
Joined
Apr 4, 2002
Messages
95
The noob is back. I've been away from this board for a few years (and I've forgotten most of what little I knew) but now I'm back with more dumb questions.

I want to make a search function that searches certain fields based on the value of a combo box which is a list of the fields. I'm using the InStr() function to try and search the fields but I can't seem to pull the record data. Instead, it just searches for the text within the name of the field. Any ideas?

Code:
SELECT tblProblem_Expectation_2.ID, tblProblem_Expectation_2.Who, tblProblem_Expectation_2.[What (S/N)], tblProblem_Expectation_2.[Problem Statement], InStr(1,[Problem Statement],Forms!frmSearch!txtSearch,2) AS Expr1, "["+Forms!frmSearch!cboFields+"]" AS Expr3, InStr(1,[tblProblem_Expectation_2]!Expr3,[Forms]![frmSearch]![txtSearch],2) AS Expr4
FROM tblProblem_Expectation_2;

To clarify, Expr3 is the field I want to search using the term in txtSearch but I end up searching the name of the field rather than the data within it.
 

Users who are viewing this thread

Back
Top Bottom