Sunny said:
On subreport, I have group by ItemNo and there is ItemNo text control on
Group header. Record source of the text control is Itemno which is one of
the field of subreport record source.
Now in groupheader format event I am trying to find opening balance with
OpenBal function and I am passing ItemNo as parameter. e.g nOpBal =
OpenBal(ItemNo), This ItemNo refers to empty.
Probably a couple of issues going on here.
First, if you want to refer to a field in the report's
record source, you also need to use it in a detail section
control's ControlSource, either as a bound field or in an
expression. This somewhat annoying requirement is because
of an Access optimazation where reports (unlike forms) do
not waste time retrieving fields that it thinks are not
used.
Second, you must have some kind of typo somewhere. If the
text box was actually named ItemNo, the same as the field,
then your code would refer to the control without complaint.
The straightforward way to do all this is to refer to the
control containing the desired value and don't mess around
trying to refer directly to a field.
--
Marsh
MVP [MS Access]