假设:你的帐务数据是存放在数据库的Table1中,该表中共有3个字段分别为:
jf 借方金额
df 贷方金额
ze 总额
可以用一下程序进行计算:
Private Sub 命令0_Click()
Dim MyRS As Recordset, LastSum As Long
Set MyRS = CurrentDb.OpenRecordset("table1")
If Not MyRS.EOF Then
LastSum = MyRS("ze")
MyRS.MoveNext
End If
Do Until MyRS.EOF
LastSum = LastSum - MyRS("jf") + MyRS("df")
MyRS.EditMode
MyRS("ze") = LastSum
MyRS.Update
MyRS.MoveNext
Loop
End Sub