Forums
This topic is locked
Problems with LIKE statement in recordset
Posted 11 Nov 2004 13:42:18
1
has voted
11 Nov 2004 13:42:18 kirsty burgoine posted:
Hi,I'm having problems creating a search. What I want to do is create a keyword search that only searches one column of my database. Each field in the column has several keywords and I want to get results from all fields that contain the word put in the serch box. For example:
If somebody searches for the word 'Stand' I want results from all fields in that column that contain the word 'Stand' including Violin Stand, Cello Stand, Guitar Stand etc. I don't want it to only match with fields that have only the word 'Stand' in.
My statement in the recordset for the search box is this:
SELECT Instrument_Type
FROM Stock
WHERE Instrument_Type LIKE '%MMColParam%'
My variable reads like this:
Name: MMColParam
Default Value: Stand
Run-Time Value: Request.QueryString("txtKeyword"

My problem is that it appears to work when I test the recordset but only on the default value I have to enter in the variables. When I test the search in my browser if I enter anything other than the default value or something that matches exactly it brings back 0 results.
I thought this would be simple to achieve but I can't see where I'm going wrong.
I hope someone can help.
Kirsty
Replies
Replied 11 Nov 2004 19:31:06
11 Nov 2004 19:31:06 Wayne Hultum replied:
try using % as your default value
Edited by - wayne1000 on 11 Nov 2004 19:31:29
Edited by - wayne1000 on 11 Nov 2004 19:31:29