Hello every one i have 2 tables in ms access i just want to ask what is the code for subtracting the BALANCE-Amount Paid?
(Table1)Loan_Information
- Date_Today
- ID_No
- FirstName
- LastName
- Loan_Amount
- Interest
- Due
- Balance
(Table2)Payment
- ID_No
- FirstName
- LastName
- Amount Paid
Here's The Code that i tried. it only saving the paymentinfo but doesn`t subtract the Balance in (Table_1) Loan_Information
ds = New DataSet
adapter = New OleDbDataAdapter("insert into [Payment] ([Date_Today], [ID_No], [FirstName], [LastName], [Amount_Paid]) VALUES " & "('" & txtPaymentDate.Text & "','" & txtPaymentIDNo.Text & "','" & txtPaymentFirstName.Text & "','" & txtPaymentLastName.Text & "','" & txtPaymentAmount.Text & "')", conn)
adapter.Fill(ds, "Payment")
ds2 = New DataSet
adapter = New OleDbDataAdapter("update [Loan_Information] set Balance = Balance - '" & txtPaymentAmount.Text & "' where ID_No = " & txtIDNo.Text, conn)
adapter.Fill(ds2, "Loan_Information")