pagina que envia el formulario:
Código:
<form method="POST" action=consultascomercial_b.asp>
<p align="left"><b><br>
&nbsp; Consultar visitas de comerciales</b></p>
<p align="left">&nbsp;&nbsp; Nombre comercial:
<select size="1" name="comercial">
<%do while not miconexion.eof %>
<option value=<% Response.write(miconexion.fields("dni") & " <br>")%><% response.write(miconexion.fields("nombre") & " <br>")%></option>
&nbsp; <% miconexion.movenext
loop%>
<option selected value="*">Todos los comerciales</option>
</select>
<p align="left">&nbsp; Visita realizada entre el día:<input type="text" name="fechaini" size="9"> &nbsp;<br>
y el: <input type="text" name="fechafin" size="9">
(ej.20/01/1981)<br>
</p>
<p align="center"><input type="submit" value="Enviar" name="B1"><input type="reset" value="borrar" name="B2"><br>
</p>
</form>
Pagina que lo recibe(aki esta el error)
Código:
if comercial='*' and fechaini="" and fechafin="" then
strsql = "select * from visitas "
else if comercial='*' and fechaini<>"" and fechafin<>"" then
strsql = "select * from visitas where fecha>="&fechaini& "and" &fecha<=fechafin
else
if fechaini="" and fechaini="" then
strsql="select * from visitas where dni=" &comercial
else
strsql="select * from visitas where dni= " &comercial& "and fecha >= " & fechaini & " and fecha <= "&
las variables comercial,fechaini y fechafin estan bien definidas. Podeis ayudar, el error está en los if creo.
Gracias