I would like to have 4 text boxes which when submitted ALL searches one field in the database to give multiple results in the same loop. However, I would like it so that the user can decide to fill only one box in for example if they decide, leave the other 3 blank and still get the appropraite result and so on.
Is the filter and sql etc used below any way close to getting this?...
<%
w = Request.QueryString("w_etc"
x = Request.QueryString("x_etc"
y = Request.QueryString("y_etc "
z = Request.QueryString("y_etc"
%>
<%
' set up database conection
' this connection does not require an ODBC reference
path = Trim(Server.MapPath("/PATH")
conn_string = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + path + "\DATABASE.mdb"
Set con = Server.CreateObject("ADODB.Connection"
con.open conn_string
IF cstr(w) <> "" THEN
mode="filtered"
mySQL = "SELECT * FROM DB_table where FIELD like " & chr(39) &cstr(w) & chr(39)&";"
END IF
IF cstr(x) <> "" THEN
mode="filtered"
mySQL = "SELECT * FROM DB_table where FIELD like " & chr(39) &cstr(x) & chr(39)&";"
END IF
IF cstr <> "" THEN
mode="filtered"
mySQL = "SELECT * FROM DB_table where FIELD like " & chr(39) &cstr & chr(39)&";"
END IF
IF cstr(Z) <> "" THEN
mode="filtered"
mySQL = "SELECT * FROM DB_table where FIELD like " & chr(39) &cstr(Z) & chr(39)&";"
END IF
Set rs = Server.CreateObject("ADODB.Recordset"
rs.Open mySQL, con, 0, 1
%>
Any help would be appreciated on either the starting form or how to process the search criteria etc etc or any comments if you have similar examples on your pages.
Thanks in advance,
Marcus
Is the filter and sql etc used below any way close to getting this?...
<%
w = Request.QueryString("w_etc"
x = Request.QueryString("x_etc"
y = Request.QueryString("y_etc "
z = Request.QueryString("y_etc"
%>
<%
' set up database conection
' this connection does not require an ODBC reference
path = Trim(Server.MapPath("/PATH")
conn_string = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + path + "\DATABASE.mdb"
Set con = Server.CreateObject("ADODB.Connection"
con.open conn_string
IF cstr(w) <> "" THEN
mode="filtered"
mySQL = "SELECT * FROM DB_table where FIELD like " & chr(39) &cstr(w) & chr(39)&";"
END IF
IF cstr(x) <> "" THEN
mode="filtered"
mySQL = "SELECT * FROM DB_table where FIELD like " & chr(39) &cstr(x) & chr(39)&";"
END IF
IF cstr <> "" THEN
mode="filtered"
mySQL = "SELECT * FROM DB_table where FIELD like " & chr(39) &cstr & chr(39)&";"
END IF
IF cstr(Z) <> "" THEN
mode="filtered"
mySQL = "SELECT * FROM DB_table where FIELD like " & chr(39) &cstr(Z) & chr(39)&";"
END IF
Set rs = Server.CreateObject("ADODB.Recordset"
rs.Open mySQL, con, 0, 1
%>
Any help would be appreciated on either the starting form or how to process the search criteria etc etc or any comments if you have similar examples on your pages.
Thanks in advance,
Marcus