Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/01/2004, 03:20
wwwmaster
 
Fecha de Ingreso: noviembre-2002
Ubicación: DF
Mensajes: 1.056
Antigüedad: 22 años, 5 meses
Puntos: 37
yo acostumbro hacerlo mas o menos asi:

sqlWhere = ""
if marca<>"" and ucase(marca)<>"CUALQUIERA" then
if sqlWhere <> "" then sqlWhere=sqlWHere & " AND "
sqlWhere = sqlWhere & " Marca = '" & marca & "'"
end if
if procesador<>"" and ucase(procesador)<>"CUALQUIERA" then
if sqlWhere <> "" then sqlWhere=sqlWHere & " AND "
sqlWhere = sqlWhere & " procesador= '" & procesador& "'"
end if
if velocidad<>"" and ucase(velocidad)<>"CUALQUIERA" then
if sqlWhere <> "" then sqlWhere=sqlWHere & " AND "
sqlWhere = sqlWhere & " velocidad= '" & procesador& "'"
end if

' Finalmente arma el SQl
strSql = "SELECT * from EQUIPOS"
if sqlWhere <>"" then strSql = strSql & " WHERE " & sqlWhere


De esta manera tienes la facilidad de irle agregando condiciones como vayan llegando las variables.. con "CUALQUIERA", pues no se mete en el WHERE para que tome todas.
Saludos