Visual Basic Codigos
Dim cant As Integer
Private Sub borrar_Click()
Dim r As Integer
On Error GoTo rutinadeerror
r = MsgBox("¿Desea borrar el Registro?", vbYesNo, "ATENCION")If r <> vbYes Then Exit Sub
Adodc2.Recordset.Delete
Adodc2.Recordset.MoveNext
sumar
If Adodc2.Recordset.EOF Then
Adodc2.Recordset.MoveLast
Total = 0
DataGrid1.Row =0
DataGrid1.Col = 4 ' Suponemos columna del importe
For i = 1 To DataGrid1.ApproxCount
Total = Total + CCur(DataGrid1.Text)
If i = DataGrid1.ApproxCount Then
Label9 =Format(Total, "###,###,###.###.00")
Else
DataGrid1.Row = DataGrid1.Row + 1
End If
Next
End If
Exit Sub
rutinadeerror:
r = MsgBox(Error, vbonly, "se ha producidoun error:")
Adodc2.Recordset.CancelUpdate
End Sub
Private Sub Command1_Click()
Adodc1.Recordset.Update
' Adodc3.Recordset!Cantidad = cant
' Adodc3.Recordset.Update'mensaje$ = "Su factura es No.: " + Label2.Caption
MsgBox "GUARDADO", vbInformation, "Guardado"
Adodc1.Refresh
Text1.Enabled = False
nuevo.Enabled = True
End Sub
Private SubCommand2_Click()
sumar
End Sub
Private Sub Form_Load()
codfac = 0
Text1.Text = 0
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = FalseLabel3.Caption = Label2.Caption
Adodc2.Recordset.Filter = "Num_Fac=" & Trim(Label3.Caption)
sumar
formato_Grid
End Sub
Private Sub Nuevo_Click()
If Adodc1.Recordset.EOF = FalseOr Adodc1.Recordset.BOF = False Then
Adodc1.Recordset.MoveLast
codfac = Adodc1.Recordset!Num_Fact
' DataGrid1.AllowDelete = True
Else
codfac = 0
End If ' Adodc2.RefreshAdodc1.Recordset!Num_Fact = codfac + 1
Label3.Caption = Label2.Caption
Adodc2.Recordset.Filter = "Num_Fac=" & Trim(Label3.Caption)
sumar
Text1.Enabled = True
nuevo.Enabled = False
End Sub...
Regístrate para leer el documento completo.