I have created a query by form using the instructions here:
__________
1. Create unbound form with text boxes for each field to search. Name text boxes. Save form and reopen it
2. With form open, create query
In order to get variations on the search term use asterisks and Like
Like "*" & [forms]![Search_Form]![Name] & "*"
________
I have a basic table which has a Keywords field. It is just a text field; in some records, I have entered multiple keywords in that field.
When I search on Keyword, the db returns all records with any keyword as well as some records with no data in the field. I have two other searches (name, state) which work perfectly and only return records with data but the keyword search doesn't work at all.
Here is the search query that the QBF runs. I have substituted 'database' for my DB name.
_________________
SELECT Database.Name, Database.State, Database.Keywords
FROM Database
WHERE (((Database.Name) Like "*" & [forms]![Search_Form]![Name] & "*") AND ((Database.State) Like "*" & [forms]![Search_Form]![State] & "*") AND ((Database.Keywords) Like "*" & [forms]![Search_Form]![Keywords] & "*"));
I have tried a number of things with no success.
I want the db to return the records ONLY if the search string exists.
Should I structure the keyword field differently? - I'm thinking the * tells the DB to return all records in the field but don't know how to search a partial keyword string without returning irrelevant results.
I created a query like this before and it worked but it was years ago and I've lost the plot.
Any help would be greatly appreciated.
__________
1. Create unbound form with text boxes for each field to search. Name text boxes. Save form and reopen it
2. With form open, create query
In order to get variations on the search term use asterisks and Like
Like "*" & [forms]![Search_Form]![Name] & "*"
________
I have a basic table which has a Keywords field. It is just a text field; in some records, I have entered multiple keywords in that field.
When I search on Keyword, the db returns all records with any keyword as well as some records with no data in the field. I have two other searches (name, state) which work perfectly and only return records with data but the keyword search doesn't work at all.
Here is the search query that the QBF runs. I have substituted 'database' for my DB name.
_________________
SELECT Database.Name, Database.State, Database.Keywords
FROM Database
WHERE (((Database.Name) Like "*" & [forms]![Search_Form]![Name] & "*") AND ((Database.State) Like "*" & [forms]![Search_Form]![State] & "*") AND ((Database.Keywords) Like "*" & [forms]![Search_Form]![Keywords] & "*"));
I have tried a number of things with no success.
I want the db to return the records ONLY if the search string exists.
Should I structure the keyword field differently? - I'm thinking the * tells the DB to return all records in the field but don't know how to search a partial keyword string without returning irrelevant results.
I created a query like this before and it worked but it was years ago and I've lost the plot.

Any help would be greatly appreciated.