Calling a module in a control on a report

  • Thread starter Thread starter Rebecca
  • Start date Start date
R

Rebecca

Hello,

I wrote a module in Microsoft Access that calculates the
moving average of Actual effort for the current quarter,
as well as the past 3 quarters. I would like to use this
module in a text box on my report down in the "quarter
footer" section. I have typed the following into the text
box control source:

=MovAvg([actual_effort_hrs],[Quarter],4)

(MovAvg is the name of my function within the module,
actual_effort_hrs is a bound text box on the report, and
quarter is also bound to a table and contains a header and
footer for the report.)

However, when I preview the report I get the following
message where my text box is: #Name?.

Please let me know if you have any suggestions on how to
fix my problem so that my quarter footer will show a
moving average based on the past 4 quarters. Thanks, have
a good day!
 
The #Name? clue is a good pointer.

When you drop fields onto a report, access makes the
control name (usually a text box) the same as the field
name, and then proceeds to get horribly confused when you
use the name in a fucntion.

Always change the name of the bound control, even if you
just prefix it with "txt" immediately after you drop them.
If you leave it till later, access will also change
references to match the new name, and you will get even
more confused.
 
Rebecca said:
I wrote a module in Microsoft Access that calculates the
moving average of Actual effort for the current quarter,
as well as the past 3 quarters. I would like to use this
module in a text box on my report down in the "quarter
footer" section. I have typed the following into the text
box control source:

=MovAvg([actual_effort_hrs],[Quarter],4)

(MovAvg is the name of my function within the module,
actual_effort_hrs is a bound text box on the report, and
quarter is also bound to a table and contains a header and
footer for the report.)

However, when I preview the report I get the following
message where my text box is: #Name?.


I don't understand what Quarter is. You said it's
"quarter is also bound to a table
and contains a header and footer
for the report"
but neither a text box nor a field in the report's record
source table/query can contain a header or footer.

To me, it looks like Quarter is not in the report's record
source table/query, are you sure it is and that it is
spelled correctly?
 
Back
Top