Para la parte en que se Busca un docente ya sea por cedula, nombre o apellido utilizamos en Frame y dentro de él tres botones de opción.
Debes modificar la propiedad caption del frame con el texto SELECCIONA UNA OPCIÓN DE BUSQUEDA y a los botones de option1, option2 y option3 le modificas su propiedad caption con los nombres: CEDULA, NOMBRES y APELLIDOS respectivamente. Además dentro del frame colocan un CommandButton que en su propiedad Caption dirá buscar y si desea le colocan una imagen.
Despues de cambiar el nombre a todos los botones copia el siguiente código en la ventana de código:
Private Sub modificar_Click()
habilitarcajas
habilitarcombos
habilitardtpicker
inhabilitarbotones
GUARDAR.Enabled = True
DOCUMENTO.SetFocus
End Sub
Private Sub eliminar_Click()
Dim r As Integer
On Error GoTo RutinaDeError
r = MsgBox("¿Desea eliminar el registro?", vbYesNo, "Atención")
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
End If
Exit Sub
RutinaDeError:
r = MsgBox(Error, vbOKOnly, "Se ha producido un error: ")
Adodc1.Recordset.CancelUpdate
End Sub
Private Sub buscar_Click()
Dim buscado As String, criterio As String
If Option1.Value = False And Option2.Value = False And Option3.Value = False Then
Mensaje = MsgBox("SELECCIONA UNA OPCION DE BUSQUEDA", vbCritical, "SELECCIONAR OPCION")
Else
If Option1.Value = True Then
buscado = InputBox("¿CEDULA DEL DOCENTE:?")
If buscado = "" Then Exit Sub
criterio = "CEDULA like '*" & buscado & "*'"
Adodc1.Recordset.MoveNext
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.Find criterio
End If
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find criterio
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
MsgBox ("CEDULA NO ENCONTRADA")
End If
End If
Else
If Option2.Value = True Then
buscado = InputBox("¿NOMBRES DEL DOCENTE:?")
If buscado = "" Then Exit Sub
criterio = "NOMBRES like '*" & buscado & "*'"
Adodc1.Recordset.MoveNext
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.Find criterio
End If
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find criterio
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
MsgBox ("NOMBRE NO ENCONTRADO")
End If
End If
Else
buscado = InputBox("¿APELLIDOS DEL DOCENTE:?")
If buscado = "" Then Exit Sub
criterio = "APELLIDOS like '*" & buscado & "*'"
Adodc1.Recordset.MoveNext
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.Find criterio
End If
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find criterio
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
MsgBox ("APELLIDO NO ENCONTRADO")
End If
End If
End If
End If
End If
End Sub
No hay comentarios:
Publicar un comentario
No dejes de comentar!!!