ACCESS 2003 - Can't get a sum in VBA
Posted on 2007-10-13
In a procedure I want something like the following - only that works.
Dim InvAmt As Currency, SumAmt As Currency
InvAmt = Forms!frmPurchaseOrder!txtInvoiceAmount
SumAmt = Sum(Forms!frmPurchaseOrder![AP_Job SubForm]![amount])
Forms!frmPurchaseOrder![AP_Job SubForm]!txtRemainder = InvAmt - SumAmt
However, the compiler does not like the middle statement. It objects to = Sum(Forms!... etc. Specifically it does not like the Sum, which it feels should be a Sub or Function. I thought it was an intrinsic function. Wrong again!
What do you suggest I do to get to give SumAmt the total of the [amount] in a line item set.