Starting with your code and marking the changes:
Code:
<%
Dim connStr
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("db4.mdb")
Dim rs, strSQL
Dim objCommand
Dim OrderBy, OrderbyIs
Dim whereClause
OrderBy = Request.QueryString("order")
Select Case OrderBy
Case "1"
OrderbyIs = " ORDER BY year"
Case "2"
OrderbyIs = " ORDER BY make"
' and so on..
Case Else
OrderbyIs = ""
End Select
whereClause = " WHERE body = 'C'" 'this can be replaced by any criteria, see explanation at bottom
strSQl = "SELECT * FROM tblInventory" & whereClause & OrderbyIs
Set objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = connStr
objCommand.CommandText=strSQL
objCommand.CommandType=adCmdText
Set rs = objCommand.Execute
Set objCommand = Nothing
rs.MoveFirst
Response.Write "Showing only Cars/Vans :" & vbcrlf
While Not rs.EOF
ShowRec rs("Year"), rs("Make"), rs("Model"), rs("price")
rs.MoveNext
Wend
' Moving the record pointer to the beginning
rs.MoveFirst
Set rs = Nothing
%>
<font size="1"><a href="try.asp?order=2">sort by make</a></font>
The idea with the from clause is that you can actually set up multiple search criterion and add them. Pretend for a moment that you have checkboixes on the previous page. One for cars, one for trucks, one for vans (you get the idea)
They are named (respectively, for out example): chkCar, chkTruck, chkVan
Pretend that those correspond to the values in your db.
To create the fromClause you can simply do something like this:
Code:
strSQl = "SELECT * FROM tblInventory"
Dim fromClause
fromClause = " WHERE"
If Request("chkCar") <> "" Then
fromClause = fromClause & " body = 'C' OR"
End If
If Request("chkTruck") <> "" Then
fromClause = fromClause & " body = 'T' OR"
End If
If Request("chkVan") <> "" Then
fromClause = fromClause & " body = 'V' OR"
End If
'if from clause length > 6 then we have search criteria
If len(fromClause) > 6 Then
'kill the last OR
fromClause = left(fromClause,len(fromClause)-2)
strSQl = strSQl & fromClause
End If
strSQl = strSQl & OrderbyIs
You'll notice I also started the sql statement above the where and order additions, since that part won't change it's nice to put it up there out of the way. You should be able to see how you can also have a drop down instead of checkboxes, in that case you could call it cboBody or somesuch and if it <> "" then search where body = value of Request("cboCody"

. All you would have to do is set up your options for the drop down like:
Code:
<select name="cboBody">
<option value="">[Select BodyStyle]</option>
<option value="C">Car</option>
<option value="V">Van</option>
<option value="T">Truck</option>
</select>
-Tarwn
Sorry if i got carried away, haven't slept in a while ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation