I am trying to develop a "Search" function for my database that is accomplished by a Query.
I have created 3 unbound text boxes that the Query will run from. For example, I have a "Member Number" text box, a "Member Last Name" text box and a "Vehicle Make" text box. Ideally I want the user to be able to populate 1 or a combination of text boxes and have the Query run against all the entered text. So If the user only enters a "Member Number", but no other fields; the Query will return all rows that match the "Member Number". If the user enters the "Member Number" and "Member Last Name" the Query will return rows that meet both criteria.
If I use the "AND" predicate in my Query, the user has to enter all 3 boxes with the correct text to find a particular row. If the user does not populate all text boxes, the query will never return a match, because the data base has no NULL entries for any of these fields.
If I use the "OR"predicate, the user may enter 2 or fewer text boxes, but the Query will find all rows that match criteria from either box. Ideally, if the user enters 2 or more text fields, I want to Query to only match rows where both attribrutes match within the same row.
Can someone tell me how to accomplish this ??
I have created 3 unbound text boxes that the Query will run from. For example, I have a "Member Number" text box, a "Member Last Name" text box and a "Vehicle Make" text box. Ideally I want the user to be able to populate 1 or a combination of text boxes and have the Query run against all the entered text. So If the user only enters a "Member Number", but no other fields; the Query will return all rows that match the "Member Number". If the user enters the "Member Number" and "Member Last Name" the Query will return rows that meet both criteria.
If I use the "AND" predicate in my Query, the user has to enter all 3 boxes with the correct text to find a particular row. If the user does not populate all text boxes, the query will never return a match, because the data base has no NULL entries for any of these fields.
If I use the "OR"predicate, the user may enter 2 or fewer text boxes, but the Query will find all rows that match criteria from either box. Ideally, if the user enters 2 or more text fields, I want to Query to only match rows where both attribrutes match within the same row.
Can someone tell me how to accomplish this ??