Average a text box, text box populated with VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top