Cita:
Iniciado por seba123neo
Código vb:
Ver originalvSQL = "SELECT * FROM tbl_nombres WHERE 1=1"
If txtapaterno.Text <> "" Then
vSQL = vSQL & " AND apaterno LIKE '%" & Trim(txtapaterno.Text) & "%'"
End If
If txtamaterno.Text <> "" Then
vSQL = vSQL & " AND amaterno LIKE '%" & Trim(txtamaterno.Text) & "%'"
End If
Hola seba123neo, eres Excelente, he tenido varias respuestas tuyas y la verdad eres muy bueno, agrego mi codigo con la solucion propuesta, muchas gracias, Saludos!!!
Private Sub cmdBuscar_Click()
vSQL = "SELECT * FROM tbl_sicotra WHERE 1=1"
If Text1.Text <> "" Then
vSQL = vSQL & " AND a_paterno LIKE '%" & Trim(Text1.Text) & "%'"
End If
If Text3.Text <> "" Then
vSQL = vSQL & " AND a_materno LIKE '%" & Trim(Text3.Text) & "%'"
End If
With Adodc1
' -- establecer el tipo de Comando ( Consulta SQL )
.CommandType = adCmdText
' -- Asignar la consulta Sql ( seleccionar la tabla de la base de datos DEMO de vb)
.RecordSource = vSQL
' -- refrescar el control
.Refresh
' -- Asignar el recordset al datagrid
Set DataGrid1.DataSource = Adodc1.Recordset
' -- Selecionar el Grid por fila
DataGrid1.MarqueeStyle = dbgHighlightRowRaiseCell
' -- Ocultar el control ADODC
.Visible = False
End With
End Sub