Hi all,
I am working on an update to fire in the afterUdate event on my form if I choose to change the value.
frmAccount
CurrentBalance is Currency
tblLedger
Credit or Debit is Currency
The goal is if record is not new, and i change the opening balance amount on my form frmAccount, then it will update the tblAccountLedger (Credit or Debit) field to the new value I put in CurrentBalance field.
Just not sure what that error means and how to repair it?
Thanks for assistanceCode:Private Sub CurrentBalance_AfterUpdate() Dim strsql As String Dim db As DAO.Database Set db = CurrentDb Me.CurrentBalanceDate = Now() If Not Me.NewRecord Then Select Case Me.cboAccountTypeID Case 1 'Asset If Me.cboAccountTypeID = 1 Then CurrentDb.Execute "UPDATE tblAccountLedger SET Credit = CurrentBalance WHERE AccountID=" & Forms!frmAccount!AccountID db.Execute strsql, dbFailOnError End If Case 2 'Equity If Me.cboAccountTypeID = 2 Then CurrentDb.Execute "UPDATE tblAccountLedger SET Credit = CurrentBalance WHERE AccountID=" & Forms!frmAccount!AccountID db.Execute strsql, dbFailOnError End If Case 3 'Expense If Me.cboAccountTypeID = 3 Then CurrentDb.Execute "UPDATE tblAccountLedger SET Debit = CurrentBalance WHERE AccountID=" & Forms!frmAccount!AccountID db.Execute strsql, dbFailOnError End If Case 4 'Income If Me.cboAccountTypeID = 4 Then CurrentDb.Execute "UPDATE tblAccountLedger SET Credit = CurrentBalance WHERE AccountID=" & Forms!frmAccount!AccountID db.Execute strsql, dbFailOnError End If Case 5 'Liability (LT) If Me.cboAccountTypeID = 5 Then CurrentDb.Execute "UPDATE tblAccountLedger SET Debit = CurrentBalance WHERE AccountID=" & Forms!frmAccount!AccountID db.Execute strsql, dbFailOnError End If Case 6 'Liability (ST) If Me.cboAccountTypeID = 6 Then CurrentDb.Execute "UPDATE tblAccountLedger SET Debit = CurrentBalance WHERE AccountID=" & Forms!frmAccount!AccountID db.Execute strsql, dbFailOnError End If End Select End If Set db = Nothing End Sub
Dave