Forums

This topic is locked

numeric wildchar

Posted 24 Oct 2001 09:11:16
1
has voted
24 Oct 2001 09:11:16 Leon Radley posted:
I got it working with WHERE make = varMake


and the variable
varMake % Request.Querystring("make"

but how do i do if they dont want to enter something and I want to show all the records

the freetext one WHERE text LIKE '%freetext%'

you can have the default as % (wildchar) but how do i do it with a number doesn't work with the procent char..?

// Leon

Replies

Replied 24 Oct 2001 13:41:53
24 Oct 2001 13:41:53 Owen Eastwick replied:
You'll have to generate the whole WHERE clause using VBScript eg:

<%
If Request("selMake" = "" Then
varWherClause = "WHERE freesearch LIKE '%" & varFreeSearch & "%'"
Else
varWherClause = "WHERE make = " & varMake & " AND freesearch LIKE '%" & varFreeSearch & "%'"
End If
%>

Then set up the recordset with an SQL statement something like:

"SELECT make, freesearch FROM mc " & varWherClause


Regards

Owen.

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

Edited by - oeastwick on 10/24/2001 13:42:49

Reply to this topic