sean amables de compartir sus conocimientos por fav..

Ariel
18 de Abril del 2004
Buenas, tengo hecho un ventana de captura de datos de empleados, pero kisiera poner un text donde pueda llamar los datos de cualkier empleado (mi intención es buscarlo por numero de cedula de identidad ya k este es uno de los datos mas especificos para buscar a una persona) y me aparezca en los campos como si los estuviera capturando de nuevo, esto es con la intencion de poder modificar cualkier informacion del que busque o consultarla. les copio el codigo de la ventana para ver en k me pueden ayudar, se los agradezco de antemano y k Dios los bendiga, ah hago la aclaración de k soy principiante en esto. saludos

Option Explicit



End Sub

Private Sub TxtCedula_Change()
If Len(TxtCedula.Text) = 12 Then
cmdAceptar.SetFocus
End If

End Sub



Private Sub txtNombre_Change()

End Sub

Private Sub txtTel_Change()
If Len(txtTel.Text) = 9 Then
TxtCedula.SetFocus
End If
End Sub

Private Sub UserForm_Activate()
ActiveSheet.Range("a3").Activate

Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
End Sub

Private Sub cmdAceptar_Click()
ValidarCampos
End Sub

Private Sub cmdTerminar_Click()

Unload frmTomarDatos
End Sub

Private Sub txtInicio_Change()

If Len(txtInicio.Text) = 10 Then
txtTiempo.SetFocus
End If
End Sub

Private Sub txtTiempo_Change()
If Len(txtTiempo.Text) = 4 Then
txtDepartamento.SetFocus
End If
End Sub

Private Sub txtDepartamento_Change()
If Len(txtDepartamento.Text) = 8 Then
txtNempleado.SetFocus
End If
End Sub

Private Sub txtNempleado_Change()
If Len(txtNempleado.Text) = 5 Then
txtTel.SetFocus
End If
End Sub


Private Sub ValidarCampos()

Dim Error As String
Dim ValorMensaje As Integer
Error = "Error en los datos del formulario"
'Si el campo Nombre está vacío
If Len(txtNombre.Text) = 0 Then
ValorMensaje = MsgBox("El campo Nombre está vacío", _
vbOKOnly, Error)
txtNombre.SetFocus
Else
If Len(txtApellidos.Text) = 0 Then
ValorMensaje = MsgBox _
("El campo Apellidos está vacío", vbOKOnly, Error)
txtApellidos.SetFocus
Else

With ActiveCell
.Value = txtNombre
.Offset(0, 1).Value = txtApellidos
'2 columnas después de la activa

.Offset(0, 2).Value = txtInicio

.Offset(0, 3).Value = txtTiempo

.Offset(0, 4).Value = txtDepartamento

.Offset(0, 5).Value = txtNempleado
.Offset(0, 6).Value = txtTel
.Offset(0, 7).Value = TxtCedula
End With
ActiveCell.Offset(1, 0).Activate
BorrarFormulario
End If
End If
End Sub

Private Sub BorrarFormulario()

txtNombre.Text = ""
txtApellidos.Text = ""
txtInicio.Text = ""
txtTiempo.Text = ""
txtDepartamento.Text = ""
txtNempleado.Text = ""
txtTel.Text = ""
TxtCedula.Text = ""

txtNombre.SetFocus
End Sub