Private Sub cmdguardar_Click()
Adodc1.Recordset.Update
habilitarbotones
cmdguardar.Enabled = False
inhabilitarcajas
End Sub
Private Sub cmdnuevo_Click()
habilitarcajas
inhabilitarbotones
cmdguardar.Enabled = True
cmdcancelar.Enabled = True
Adodc1.Recordset.AddNew
txtnit.SetFocus
End Sub
habilitarbotones
cmdguardar.Enabled = False
inhabilitarcajas
End Sub
Private Sub cmdnuevo_Click()
habilitarcajas
inhabilitarbotones
cmdguardar.Enabled = True
cmdcancelar.Enabled = True
Adodc1.Recordset.AddNew
txtnit.SetFocus
End Sub
Private Sub cmdeditar_Click()
habilitarcajas
inhabilitarbotones
cmdguardar.Enabled = True
cmdcancelar.Enabled = True
txtnit.SetFocus
End Sub
Private Sub cmdeliminar_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 inhabilitarcajas()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is TextBox Then
Controls(n).Enabled = False
End If
Next n
End Sub
Private Sub habilitarcajas()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is TextBox Then
Controls(n).Enabled = True
End If
Next n
End Sub
Private Sub inhabilitarbotones()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is CommandButton Then
Controls(n).Enabled = False
End If
Next n
End Sub
Private Sub habilitarbotones()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is CommandButton Then
Controls(n).Enabled = True
End If
Next n
End Sub
habilitarcajas
inhabilitarbotones
cmdguardar.Enabled = True
cmdcancelar.Enabled = True
txtnit.SetFocus
End Sub
Private Sub cmdeliminar_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 inhabilitarcajas()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is TextBox Then
Controls(n).Enabled = False
End If
Next n
End Sub
Private Sub habilitarcajas()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is TextBox Then
Controls(n).Enabled = True
End If
Next n
End Sub
Private Sub inhabilitarbotones()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is CommandButton Then
Controls(n).Enabled = False
End If
Next n
End Sub
Private Sub habilitarbotones()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is CommandButton Then
Controls(n).Enabled = True
End If
Next n
End Sub
Private Sub inhabilitarcombobox()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is combobox Then
Controls(n).Enabled = False
End If
Next n
End Sub
Private Sub habilitarcombobox()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is combobox Then
Controls(n).Enabled = True
End If
Next n
End Sub
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is combobox Then
Controls(n).Enabled = False
End If
Next n
End Sub
Private Sub habilitarcombobox()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is combobox Then
Controls(n).Enabled = True
End If
Next n
End Sub
Private Sub inhabilitardtpicker()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is DtPicker Then
Controls(n).Enabled = False
End If
Next n
End Sub
Private Sub habilitarDtPicker()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is DtPicker Then
Controls(n).Enabled = True
End If
Next n
End Sub
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is DtPicker Then
Controls(n).Enabled = False
End If
Next n
End Sub
Private Sub habilitarDtPicker()
Dim n As Integer
For n = 0 To Controls.Count - 1
If TypeOf Controls(n) Is DtPicker Then
Controls(n).Enabled = True
End If
Next n
End Sub
No hay comentarios:
Publicar un comentario
No dejes de comentar!!!