Hi everyone, I am new to this forum and this is my first post. I am trying to update a table from a form but despite trying various options and codes I am unable to do so. My problem goes like this: It's a sort of Loan System. I have a transaction table and a master table. Master table has loanees information as well as a field called Balance. Both are joined (relationship) with RegNo. Now what I want to do is I want the Balance field to be updated (reduced) when I press OK button, with the amount I enter in transaction table. I have put following code in btnOK_click.
But somehow it's not working. Can somebody guide me where I am going wrong
Code:
Private Sub btnOK_Click()
Dim strSQL As String
strSQL = "UPDATE MasterFile INNER JOIN TransFile On (MasterFile.RegNo = TransFile.RegNo)" & _
"SET MasterFile.LastTransDate = Me!TransDate AND" & _
"MasterFile.LastBalance = MasterFile.LastBalance - Me!TransAmt" & _
"WHERE MasterFile.RegNo = Me!RegNo"
DoCmd.RunSQL strSQL
End Sub
Last edited by a moderator: