Average a text box, text box populated with VBA

G

gjs

I have a report that uses VBA to calculate the number of weekdays between 2
dates and assigns the number to a text box called ControlsDays. The report
works fine for the detailed information, I get the values correctly displayed
when I run the report.

In the footer, I built an averaging expression based on the ControlDays
through the expression builder. The text box for the averaging information is
called AvgControDays. When I run the report, a dialog box pops up and asks me
for the AvgControlDays value. It will not calculate the average based on the
data that was generated through VBA.

Any suggestions?
 
D

Duane Hookom

You can't Sum or Avg a control (text box). You can generally aggregate the
expression used as the Control Source of the control.

You didn't provide the section (footer could be group, report, or page), the
control source of the text box in the detail section, or the VBA. Assuming
you have a control source like:
=GetControlDays([BeginDate], [EndDate])
you should be able to use:
=Sum(GetControlDays([BeginDate], [EndDate]))

This reply makes a lot of assumptions....
 
Top