E
egun
I am trying to add a "generic" search function to the main form of my
database that will allow the user to choose a field to search and enter a
string to search for. To do this, I have added two controls. The first is a
combo box whose source is the Field List from the table feeding the form.
The second is a text box in which the user can type a string to be searched
for.
Here is how I want it to work:
1. User selects the specific field to search in the combo box. This part
works fine.
2. User types in a text string in the text box (something like *ability or
%time or whatever). Also works fine.
3. User presses the "Search" button, and the database is filtered to show
only records for which the selected field matches the criterion.
I have tried using:
Me.Filter = "[" & SelectedFieldName & "] Like '" & SearchText & "' "
Me.FilterOn = True
but I always get zero records, even when the selected field is a text field.
I know this is probably harder than I want it to be. Any suggestions will
be greatly appreciated. Including "Trust me, it's too hard - just give up"
Eric
database that will allow the user to choose a field to search and enter a
string to search for. To do this, I have added two controls. The first is a
combo box whose source is the Field List from the table feeding the form.
The second is a text box in which the user can type a string to be searched
for.
Here is how I want it to work:
1. User selects the specific field to search in the combo box. This part
works fine.
2. User types in a text string in the text box (something like *ability or
%time or whatever). Also works fine.
3. User presses the "Search" button, and the database is filtered to show
only records for which the selected field matches the criterion.
I have tried using:
Me.Filter = "[" & SelectedFieldName & "] Like '" & SearchText & "' "
Me.FilterOn = True
but I always get zero records, even when the selected field is a text field.
I know this is probably harder than I want it to be. Any suggestions will
be greatly appreciated. Including "Trust me, it's too hard - just give up"
Eric