|    
			
				21/04/2010, 08:23
			
			
			  | 
  |   |  |  |  |  Fecha de Ingreso: septiembre-2009 
						Mensajes: 502
					 Antigüedad: 16 años, 1 mes Puntos: 47 |  | 
  |  Respuesta: Filtrar un listbox por varios criterios  
  Por que no haces la sentencia y luego la pasas? es un poquito mas entendible...
 dim strCabecera as string, strSelect as string, strSentencia as string
 
 strCabecera = "SELECT * FROM TABLAALBERTO WHERE "
 
 IF Chk_Operario.Value = 1 THEN
 IF strSelect<>"" then
 strSelect=strSelect & " Nombre = '" & Cbb_Operario.Text & "'"
 else
 strSelect=strSelect & " AND Nombre = '" & Cbb_Operario.Text & "'"
 end if
 end if
 
 IF Chk_Fecha.Value = 1 THEN
 IF strSelect<>"" then
 strSelect=strSelect & " FHInicio = '" & Txt_Fecha & "'"
 else
 strSelect=strSelect & " AND FHInicio = '" & Txt_Fecha & "'"
 end if
 end if
 ...
 ...
 ...
 strSentencia=strCabecera & strSelect '<---- DETEN EL PROGRAMA AQUI PARA EVALUAR LA SENTENCIA
 rs.Open strSentencia, cn
 ..
 ..
 
 Asi puedes evaluar la sentencia antes del RS.OPEN
   Última edición por lokoman; 21/04/2010 a las 08:41
     |