[thelist] SQL

kev.skindrill kev.skindrill at bigfoot.com
Fri Aug 11 08:40:29 CDT 2000


Could someone give me a bit of guidance here please? I have a drop down box
with 5 possible options & what I am trying to acheive is that if option 3 is
selected then options 1 and 2 are also shown. To get this I have written the
following code...

if request.form("minsize")="Motorbike" then
 pcnum="Motorbike"
elseif request.form("minsize")="Transit" then
 pcnum="Motorbike, Transit"
elseif request.form("minsize")="7 Ton Truck" then
 pcnum="Motorbike, Transit, 7 Ton Truck"
elseif request.form("minsize")="17 Ton Truck" then
 pcnum="Motorbike, Transit, 7 Ton Truck, 17 Ton Truck"
elseif request.form("minsize")="40 Ton Truck" then
 pcnum="Motorbike, Transit, 7 Ton Truck, 17 Ton Truck, 40 Ton Truck"
end if

and then I have the SQL statement as follows...

("SELECT * FROM Deliveries where MinimumVehicleSize=("&pcnum&") and
Available = 1")

But I get this error message...

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in
query expression 'MinimumVehicleSize=(Motorbike, Transit, 7 Ton Truck) and
Available = 1'.

So as far as I can see I have successfully changed the results of
request.form("minsize") into a string because it is showing up as a comma
seperated list in the error message, but what is this "missing operator"
business? This code worked perfectly when I had this SQL statement...

("SELECT * FROM Deliveries where
MinimumVehicleSize='"&request.form("minsize")&"' and Available = 1")

which (as far as I understand it) amounts to the same thing.

TIA

K








More information about the thelist mailing list