Forums

This topic is locked

keyword searching fields in access

Posted 21 Jan 2002 17:07:50
1
has voted
21 Jan 2002 17:07:50 Stefan P posted:
Hello All

I'm trying to build a search page for a site that has numerous article in an Access DB. I'm not too sure how to build the SLQ statement. I would like visitors to be able to search for keyword/s that appear in either a 'heading' field or 'body text' field. Any ideas??

Thanks

Sesame

Replies

Replied 21 Jan 2002 17:48:36
21 Jan 2002 17:48:36 Owen Eastwick replied:
You can build a query in Access that concatenates the fields, something like:

SELECT RecordID, HeadingText, BodyText, HeadingText & " " & BodyText AS CombinedFields FROM TableName

Then use this Query to create a recordset on the page in the same way as you would a Table.

Then:

SearchWord = Replace(Request("TextFieldName",""", "''"

Then set up the recordset something like:

RecordsetName.Source = "SELECT HeadingText, BodyText FROM YourQueryName WHERE CombinedFields LIKE '" & SearchWord & "'"

Take a look at the link below for more advanced search features.

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo

Edited by - oeastwick on 21 Jan 2002 17:50:27
Replied 30 Apr 2002 01:26:23
30 Apr 2002 01:26:23 Leon Vigen replied:
Will this query code work with several fields?
Could one use ... SELECT RecordID, HeadingText,BodyText, Url, Keyword, HeadingText & " " & BodyText & " " & Url & " " & Keyword AS CombinedFields FROM TableName

Is this apliable?
Replied 19 Sep 2002 18:13:00
19 Sep 2002 18:13:00 Wil Turrin replied:
Hi

I need to develop this in javascript! Do you have any thought?

W

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
You can build a query in Access that concatenates the fields, something like:

SELECT RecordID, HeadingText, BodyText, HeadingText & " " & BodyText AS CombinedFields FROM TableName

Then use this Query to create a recordset on the page in the same way as you would a Table.

Then:

SearchWord = Replace(Request("TextFieldName",""", "''"

Then set up the recordset something like:

RecordsetName.Source = "SELECT HeadingText, BodyText FROM YourQueryName WHERE CombinedFields LIKE '" & SearchWord & "'"

Take a look at the link below for more advanced search features.

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo

Edited by - oeastwick on 21 Jan 2002 17:50:27
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Reply to this topic