Forums

ASP

This topic is locked

Urgent Recordset Help

Posted 10 Jul 2007 18:27:42
1
has voted
10 Jul 2007 18:27:42 john pepper posted:
Tring to create recordset from Query which is a keyword results page if i base the results page on one column of the table ie:

SELECT *
FROM Category
WHERE Supplier Like %MMColParam%

all works fine but if i want to add columns to search for keywords ie:

SELECT *
FROM Category
WHERE Supplier Like %MMColParam% OR Product_Type Like '%MMColParam%'
when you test in on IE explorer, it will return the Like for the first one ie supplier but if you typed in a Product_type keyword, it will not return anything, but no errors apper

I have checked all tables and columns all are correct i run other recordsets fine on the same table.

Please PLease help

Replies

Replied 10 Jul 2007 18:33:19
10 Jul 2007 18:33:19 Christian Houmann replied:
Hi John
I would suggest deleting the two apostrophs in the last Like-statement. If you leave them this way, it will search for a field with a text string saying "%MMColParam%"
Replied 10 Jul 2007 18:37:59
10 Jul 2007 18:37:59 john pepper replied:
hi thanks for replying

if i delete the two apostophies then i will get a syntax error message

Any idears??
Replied 10 Jul 2007 19:05:16
10 Jul 2007 19:05:16 Christian Houmann replied:
That may be because the two database fields are not the same type (etc. Suppliers could be a number field and Product_Type a text field.)

If Product_Type is text, then try this:
"... OR Product_Type Like % ' " & MMColParam% & " ' "

Happy Coding
Replied 10 Jul 2007 22:30:13
10 Jul 2007 22:30:13 john pepper replied:
Hi thanks for the help

i checked the fields back on the database and they are all set to text, i also tried the code that you sent and that to gave me a syntax error.

any more suggestions?
Replied 11 Jul 2007 14:09:52
11 Jul 2007 14:09:52 Christian Houmann replied:
Sorry. I mistyped the code, it should be like this:

"... OR Product_Type Like % ' " & MMColParam & " ' %"

If this doesn't help, then I can't figure it out. Let's hope someone else can help...

Reply to this topic