i don't know what to do about this one. there are some very strange things going on. i have a continuous form with a bound textbox and a bound toggle button. the textbox is named "Payment" and the toggle is named "Apply." i want to have a textbox in the footer (named TotalPayment) that calculates the sum of whatever is in the textbox, provided that the bound toggle button is set to True. i created a function for this purpose. here it is:
at first i tried placing this code into TotalPayment:
i also tried placing Nz([Payment],0) and that did not change it from returning "#Error"
my next step was to create an additional textbox in the form (named PaymentTest) to test if the function was working or not:
this returned the correct values.
then, i set TotalPayment to
once again, the sum function does not work and returns "#Error"
and here's the weird part, i deleted TotalPayment and created a new textbox in the footer and set it to:
and it worked... UNTIL i placed the TotalPayment textbox back into the footer with the code:
and now, neither one of the textboxes work. would someone kindly explain to me why this is happening and what i can do to work around this? thanks in advance for all your help
Code:
Function AmountTF(TF, Amount) As Double If TF = True Then AmountTF = Nz(Amount, 0) Else: AmountTF = 0 End If End Function
Code:
=Sum(AmountTF([Apply],[Payment]))
my next step was to create an additional textbox in the form (named PaymentTest) to test if the function was working or not:
Code:
=AmountTF([Apply],[Payment])
then, i set TotalPayment to
Code:
=Sum([PaymentTest])
and here's the weird part, i deleted TotalPayment and created a new textbox in the footer and set it to:
Code:
=Sum([Payment])
Code:
=Sum(AmountTF([Apply],[Payment]))
Comment