Ver Mensaje Individual
  #6 (permalink)  
Antiguo 20/03/2009, 16:16
Avatar de totigo
totigo
 
Fecha de Ingreso: marzo-2007
Ubicación: America
Mensajes: 103
Antigüedad: 18 años, 2 meses
Puntos: 3
De acuerdo Respuesta: Aplicar rs.filter dependiendo si un textbox esta vacio ó no

Ok! a ver si este te sirve!

'Si ya hay un filtro agregas el AND
If Len(ContentSQL) > 0 Then ContentSQL = ContentSQL & " AND "

Código VB:
Ver original
  1. ContentSQL = ""
  2.  
  3. If Len(Text1.Text) > 0 Then
  4.    'Aplicamos filtro
  5.   ContentSQL = ContentSQL & " codcat='" & Text1 & "'"
  6. End If
  7.  
  8. If Len(Text2.Text) >0 Then
  9.     'Si ya hay un filtro agregas el AND
  10.    If Len(ContentSQL) > 0 Then ContentSQL = ContentSQL & " AND "
  11.    
  12.    'Aplicamos filtro
  13.   ContentSQL = ContentSQL & " codmarca='" & Text2 & "'"
  14. End If
  15.  
  16.  
  17. If Not rsProd.EOF Then
  18.     rsProd.Filter = ContentSQL
  19. End If