Forum Moderators: open
dim make_name
dim model_name
make_name=request.form("make_search")
model_name=request.form("model_search")
%>
<%
Set MyConn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("admin\db\webpublish.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
SQL_query = "SELECT * FROM tblWebVehicles WHERE Make=((make_name))"
Set RS = MyConn.Execute(SQL_query)
%>
<% while not rs.eof%>
<FONT face="Arial, Helvetica, sans-serif" size=2><B><FONT color="#000000" size=4>
<%=rs("make")%><BR>
<%rs.movenext
wend
%>
..Nice and simple, I am passing an input from a form via the variable 'make_search' and re-assigning it to be called 'make_name.
Now, my problem is with the SQL string.. I don't know how to incorporate the variable 'make_name' into the string. Here's the line that I'm stuck on again:-
SQL_query = "SELECT * FROM tblWebVehicles WHERE Make=(make_name)"
I want to say "Select all the cars from the database that match the "make" field that the user inputted on the previous form".. a sort of search engine for the database.
Could anyone tell me what the correct syntax is for the query please? I have scoured the net trying to find out how to use variables in the SQL string and I have tried umpteen combinations to no avail.
Any help is greatly received. Thank you.