Keyword Search (1 Viewer)

saross

Registered User.
Local time
Today, 21:51
Joined
Mar 4, 2003
Messages
120
Hi all.

I want to set up a 'keyword search' facility on my dbase. I would like the user to enter a keyword in a dialog box and for this to then open my main FRMContractInfo form with a recordset that shows all the records where this word appears in any or each of four fields (Summary, Methodology, Lessons, Successes). I am a bit confused about how I should approach this, can someone offer me some advice?

Do I:

a) set up a Query that references the text box on the dialog box and code it as the open form's recordset
b) write the SQL for the form in the code?

Or are neither of these approaches correct? I've tried both and neither seem to work - but I think I've got my syntax all wrong because of trying to use Like and the wildcard (*) character...
 

stephen81

Registered User.
Local time
Today, 21:51
Joined
Nov 27, 2002
Messages
198
One approach, possibly not the best one, would be to create a query to base your form on.
If you always want to search through all 4 of those fields, then add a calculated field to your query that puts together (concatenates) the values for all those fields so that you only need to apply your criteria to one field.
i.e. Search_Field: [Summary]&[Methodology]&[Lessons]&[Successes]

and the criteria for that field in the query just needs to be LIKE "*" & [Search Term:] & "*" or something similar. That will automatically pop up a criteria prompt whenever it's run.
 

Users who are viewing this thread

Top Bottom