Header/Footer Problem

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

Guest

I have a report that uses a Function to generate an entry in the Page Header,
a Group Footer that displays the group value in a message, and a Page Footer
that uses the Page function to display the number of pages in the report.

When I run the report directly from the Reports list, all the above features
work fine.

I am experimenting with running the same report from a script using the
DoCmd.OpenReport command. When I do, the report shows the proper data, but
none of the features above work. They all produce "#Error" on the preview as
well as hard-copy. The following is my DoCmd command:

DoCmd.OpenReport "Department Profile Summary", _
acViewPreview, , CriteriaData, _
acWindowNormal

Any assistance would be appreciated.

Thanks.
 
I have a report that uses a Function
to generate an entry in the Page Header,

Please provide the actual function, and where you use it (e.g., in the
ControlSource of a Control, or in event code).
a Group Footer that displays the group
value in a message,

Please clarify "the group value"... (e.g., do you mean the Field in the
RecordSource on which you are grouping, or something else?)
and a Page Footer that uses the
Page function to display the number
of pages in the report.

"Page" is the current page, "Pages" is the number of pages in the Report.
When I run the report directly from
the Reports list, all the above features
work fine.
. When I (run the report using the
DoCmd.OpenReport command),
the report shows the proper data, but
none of the features above work.
They all produce "#Error" on the preview as
well as hard-copy.

You supplied a "WhereCondition" argument, which is applied in a similar
manner to a Filter. That should certainly not affect either "Page" or
"Pages", and, unless you filter out all values used in calculations,
shouldn't cause the #Error for the others. Perhaps with the clarifications I
mention, someone can help you pin down the problem.

Larry Linson
Microsoft Access MVP
 
The header function is used in the ControlSource. The actual function code
is as follows:
Function Get_Company()
Get_Company = CurrentDb.Containers("Databases").Documents _
("UserDefined").Properties("Client").Value
End Function

By "group value", I mean the contents/value of the field on which I am
grouping. I am grouping on CostCenter and the footer displays the message
"End of Cost Center XXXXXX".

The page footer actually uses both "Page" and "Pages". I must have misread
the terms earlier.

Hopefully this information will help.
 
Back
Top