• Viernes 18 de Octubre de 2024, 15:16

Autor Tema:  Dudas Con Busqueda?????  (Leído 1432 veces)

neorent

  • Miembro MUY activo
  • ***
  • Mensajes: 249
    • Ver Perfil
    • http://www.laestokada.cl
Dudas Con Busqueda?????
« en: Lunes 17 de Abril de 2006, 15:39 »
0
hola a todos, bueno le paso a comentar mi duda rusulta que estoy haciendo una busqueda y quiero que esta busqueda me busque en cada registro si la palabra esta creo que se cual es la linea pero tengo una duda como hago que selecione todos los campos con ¿*?, bueno a continuacion les dejo el code para que lo vean.

Option Explicit


Private Sub Command1_Click()
Buscar
End Sub

Sub limpiar()
hfgGrillaP.Clear
INICIARGRILLA
End Sub

Private Sub Form_Load()
Dim base As Database
Dim rst_base As Recordset
Dim rst_paterno As Recordset
Dim deptos As Recordset
Dim maestra As Recordset
Dim Archivo As String
Dim Nro As Double
Dim msg As String
Dim ruta As String
Archivo = App.Path & "\rutabasesoporte.TXT"
If Dir(Archivo, vbArchive) = "" Then
MsgBox "No existe archivo de configuracion de RUTA", vbInformation, "Advertencia"
Else
Nro = FreeFile
Open Archivo For Input As #Nro
Input #Nro, ruta
'Close (Linea)
End If
Call limpiar
Set base = OpenDatabase(ruta)
Set deptos = base.OpenRecordset("equipamiento_atendido")
Set maestra = base.OpenRecordset("maestro_atenciones")
Set rst_base = base.OpenRecordset("select [folio_atencion] from maestro_atenciones order by folio_atencion;", dbOpenDynaset, dbConsistent, dbOptimistic)
    rst_base.MoveNext
    rst_base.MoveFirst
Set rst_paterno = base.OpenRecordset("select * from maestro_atenciones;", dbOpenDynaset, dbConsistent, dbOptimistic)
    If rst_paterno.RecordCount > 0 Then
        rst_paterno.MoveNext
        rst_paterno.MoveFirst
       
    End If
End Sub

Sub INICIARGRILLA()
    With hfgGrillaP
        .ColWidth(0) = 1400: .TextMatrix(0, 0) = "Nº INVENTARIO"
        .ColWidth(1) = 1400: .TextMatrix(0, 1) = "NOMBRE"
        .ColWidth(2) = 1400: .TextMatrix(0, 2) = "PATERNO"
        .ColWidth(3) = 1400: .TextMatrix(0, 3) = "AREA"
        .ColWidth(4) = 1400: .TextMatrix(0, 4) = "DIRECCION"
        .ColWidth(5) = 1400: .TextMatrix(0, 5) = "DEPTO"
        .ColAlignmentFixed = 3
        .ColAlignment(0) = 0
        .ColAlignment(1) = 0
        .ColAlignment(2) = 0
        .ColAlignment(3) = 0
        .ColAlignment(4) = 0
        .ColAlignment(5) = 0
    End With
End Sub

Sub BuscarPaterno()
Dim cont As Long
Dim hhhh As Integer
Dim rst_base As Recordset
Dim base As Database
Dim rst_paterno As Recordset
Dim maestra As Recordset
Dim totalpc As Integer
Dim porcentaje As Integer
Dim total As Integer
Dim Archivo As String
Dim Nro As Double
Dim msg As String
Dim ruta As String
Archivo = App.Path & "\rutabasesoporte.TXT"
If Dir(Archivo, vbArchive) = "" Then
MsgBox "No existe archivo de configuracion de RUTA", vbInformation, "Advertencia"
Else
Nro = FreeFile
Open Archivo For Input As #Nro
Input #Nro, ruta
'Close (Linea)
End If
hfgGrillaP.Clear
INICIARGRILLA
Set base = OpenDatabase(ruta)
Set maestra = base.OpenRecordset("maestro_atenciones")
Set rst_paterno = base.OpenRecordset("select [folio_atencion],[usuario_atencion],[direccion_depto],[problema_descrito],[tecnico_asignado],[estado_atencion] from maestro_atenciones  where [usuario_atencion] like '" & Trim(Text1) & "*'order by [folio_atencion]")
 With rst_paterno
 If .RecordCount > 0 Then
    .MoveLast
   .MoveFirst
    hhhh = .RecordCount
    hfgGrillaP.Rows = .RecordCount + 1
    For cont = 1 To .RecordCount
       hfgGrillaP.TextMatrix(cont, 0) = "" & ![folio_atencion]
       hfgGrillaP.TextMatrix(cont, 1) = "" & ![usuario_atencion]
       hfgGrillaP.TextMatrix(cont, 2) = "" & ![direccion_depto]
       hfgGrillaP.TextMatrix(cont, 3) = "" & ![problema_descrito]
       hfgGrillaP.TextMatrix(cont, 4) = "" & ![tecnico_asignado]
       hfgGrillaP.TextMatrix(cont, 5) = "" & ![estado_atencion]
        .MoveNext
    Next
Else
    MsgBox "NO HAY DATOS ", vbOKOnly, "ATENCION"
End If
    End With
End Sub

Private Sub hfgGrillaP_DblClick()
Dim rut_numero As String
rut_numero = Format(hfgGrillaP.TextMatrix(hfgGrillaP.Row, 0), "")
End Sub


bueno en este code me parece que hago una busqueda por usuario bueno lo que yo quiero es que me haga una busqueda por cualquier campo no se si puede hacer si me pueden guiar seria genial muchas gracias adios
Un Tigre Nunka Kambia Sus Rayas