Hola. Necesito una ayudadita.
Como veran en la foto necesito q cada vez q entre a ese modulo el boton grabar(y el eliminar si se puede) este habilitados de un comienzo, en la actualidad, estos se habilitan solo cuando enter.
Que tengo q poner o cambiar para q se me habiliten apenas entre a ese modulo, q es una opcion de un menu.
Miren este es el codigo de la toolbar q esta en el area buttonclick:
Código:
Private Sub TbarComprobante_ButtonClick(ByVal Button As MSComctlLib.Button)
Dim nProceso As String
Dim IntC As Integer
If Button.Index = 1 Then
' Limpiar
LimpiarDatos
LimpiarDetalle
TxtId_Codigo3 = ""
TxtNombre3 = ""
TituloGrilla
TbarComprobante.Buttons.Item(2).Enabled = False
TbarComprobante.Buttons.Item(3).Enabled = False
UltimoRegistro
TxtId_Folio.SetFocus
ElseIf Button.Index = 2 Then
' Grabar
If CLng(TxtId_Folio) > 200 Then
' -------- SISTEMA, Acepta solo 200 comprobantes Maximo ---
Exit Sub
End If
If CmbEstado <> "PENDIENTE" And CmbEstado <> "NULO" Then
If Not (curDebe > 0 And curHaber > 0 And curDebe = curHaber) Then
MsgBox "Comprobante Descuadrado, en " & CStr(Format((curDebe - curHaber), "###,###,###,##0")) & " Pesos"
TxtId_Codigo3.SetFocus
Exit Sub
End If
End If
If Not ExisteFolio(TxtId_Folio) Then
nProceso = "G"
Else
nProceso = "A"
If Rs_Comprobante.Fields("Operacion") = "M" Then
BorrarDetalle
End If
End If
With Rs_Comprobante
GlrOperacion = ""
If nProceso = "G" Then
.AddNew
!Id_Folio = TxtId_Folio
!Operacion = "M"
ElseIf nProceso = "A" Then
.Edit
GlrOperacion = !Operacion
End If
!Tipo = CmbTipo
!Fecha = MebFecha
!Glosa = TxtGlosaGene
!Estado = CmbEstado
If !Operacion = "M" Then
GlrOperacion = "M"
.Update
Else
MsgBox "El Comprobante NO puede ser Modificado, Fué Generado por Ingreso de Doc."
End If
End With
If GlrOperacion = "M" Then
GrabarDetalle
End If
LimpiarDatos
LimpiarDetalle
TituloGrilla
TbarComprobante.Buttons.Item(2).Enabled = False
TbarComprobante.Buttons.Item(3).Enabled = False
UltimoRegistro
TxtId_Folio.SetFocus
ElseIf Button.Index = 3 Then
' Borrar
If ExisteFolio(TxtId_Folio) Then
If Rs_Comprobante.Fields("Operacion") = "A" Then
MsgBox "El Comprobante, Fué Generado por Ingreso de Doc."
End If
StrRespuesta = MsgBox("Está Seguro de Borrar ....", vbYesNo + vbCritical)
If StrRespuesta = vbYes Then
If Rs_Comprobante.Fields("Operacion") = "A" Then
With Rs_Comprobante
.Edit
!Estado = "NULO"
.Update
End With
Rs_Comprobante.Requery
Rs_Libros.Requery
Rs_Libros.FindFirst "Id_Folio=" & TxtId_Folio
If Not Rs_Libros.NoMatch Then
Rs_Libros.Edit
Rs_Libros.Fields("Id_Folio") = 0
Rs_Libros.Fields("Fecha") = Null
Rs_Libros.Update
End If
Else
BorrarDetalle
With Rs_Comprobante
.Delete
.MoveNext
End With
End If
End If
LimpiarDatos
LimpiarDetalle
TituloGrilla
TbarComprobante.Buttons.Item(2).Enabled = False
TbarComprobante.Buttons.Item(3).Enabled = False
UltimoRegistro
TxtId_Folio.SetFocus
End If
ElseIf Button.Index = 4 Then
' Avanzar Reg
If Not IsNumeric(TxtId_Folio) Then
TxtId_Folio.SetFocus
'Exit Function
Exit Sub
End If
If ExisteFolio(TxtId_Folio) Then
AvanzaRegistro
TxtId_Folio.SetFocus
SendKeys "{enter}"
Else
MsgBox "No Existen más Comprobantes "
LimpiarDatos
LimpiarDetalle
TituloGrilla
TbarComprobante.Buttons.Item(2).Enabled = False
TbarComprobante.Buttons.Item(3).Enabled = False
End If
ElseIf Button.Index = 5 Then
' Retroceder Reg.
If Not IsNumeric(TxtId_Folio) Then
TxtId_Folio.SetFocus
'Exit Function
Exit Sub
End If
If ExisteFolio(TxtId_Folio) Then
RetrocedeRegistro
TxtId_Folio.SetFocus
SendKeys "{enter}"
ElseIf Not ExisteFolio(TxtId_Folio) Then
With Rs_Comprobante
If Not .EOF Then
.MoveLast
TxtId_Folio = !Id_Folio
TxtId_Folio.SetFocus
SendKeys "{enter}"
End If
End With
Else
MsgBox "No Existen más Comprobantes "
Limpiar
End If
ElseIf Button.Index = 6 Then
' Ultimo
LimpiarDatos
LimpiarDetalle
TituloGrilla
TbarComprobante.Buttons.Item(2).Enabled = False
TbarComprobante.Buttons.Item(3).Enabled = False
With Rs_Comprobante
If Not .EOF Then
.MoveLast
TxtId_Folio = !Id_Folio
TxtId_Folio.SetFocus
SendKeys "{enter}"
End If
End With
ElseIf Button.Index = 7 Then
If TxtId_Folio <> "" Then
' Imprimir
Cry.DiscardSavedData = True
Cry.DataFiles(0) = GlbCarpeta & "\Contabilidad.Mdb"
Cry.SelectionFormula = "{Comprobante.Id_Folio}=" & TxtId_Folio
Cry.ReportFileName = GlbOrigenInformes_Cli & "Cli_Ct_Comprobante.Rpt"
Cry.Action = 1
Else
MsgBox "Ingrese Nro. comprobante ", vbCritical, "Formulario Comprobante Contable"
TxtId_Folio.SetFocus
End If
End If
'End Function
End Sub
Si me ayudara seria super bkn, de antemano gracias.