我是这么错误的写的
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=123456;Data Source=" + App.Path + "\123.mdb;"
Adodc1.RecordSource = "Select ID AS ID ,姓名 AS 姓名,收入金额 AS 收入金额From 月收入表 "
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=123456;Data Source=" + App.Path + "\123.mdb;"
Adodc2.RecordSource = "Select ID AS ID ,姓名 AS 姓名,余额 AS 余额 From 余额表"
Adodc2.Refresh
With Adodc1.Recordset
If Adodc1.Recordset.Fields("ID") = Adodc2.Recordset.Fields("ID") Then
Do While Not Adodc1.Recordset.EOF
.Fields("余额") = .Fields("余额") + Adodc1.Recordset.Fields("收入金额")
.Update
Adodc1.Recordset.MoveNext
Loop
End If
End With
Set DataGrid2.DataSource = Adodc2
End Sub