I have an Access report with a sub report. In the main report there is a text box (A) which takes a value from a control on the sub report. The value in text box A is then used as one element of a grand total sum in another text box (B) on the main form.
Because the value of the control on the sub report could be null, as the sub form may not return any records, I use the function below as the Control Source for text box A to force a zero (this was suggested as the answer to one of my previous questions).
All this works fine if the report has a single record. However where there is more than one record the Text box A value on the first record doesn't refresh for any subsequent record but stays the same on every page. I have tried various requeries but no luck.
Hope this makes sense - any ideas?
text box A control source =funcAvoidErrorProductTotal([chdReport].[Report]![txtTotal],0)
Function funcAvoidErrorFixedTotal(varFixedTotal As Variant, varReplaceWith As Variant)
On Error GoTo funcAvoidError_Error
If PBcurFixTotal > 0 Then
funcAvoidErrorFixedTotal = PBcurFixTotal
funcAvoidErrorFixedTotal = Nz(varFixedTotal, varReplaceWith)
If funcAvoidErrorFixedTotal > 0 Then
PBcurFixTotal = funcAvoidErrorFixedTotal
funcAvoidErrorFixedTotal = varReplaceWith