Sub Report Problem

  • Thread starter Thread starter Martureo Bob
  • Start date Start date
M

Martureo Bob

Using Access 2000, I create a report using the OpenReport method (within an
OnClick event on a form).

The main report prints details. Sorted in date sequence, this prints the
following three fields: date, "account type", and $ amount.

On the form, the user enters the starting date, the ending date, and the
individual's internal number.

The OpenReport method includes a "Where Condition" where I construct some
SQL to select the starting date, the ending date and the individual's
internal number.

The detail section of the report (which is in the main report) includes only
the data for that range of dates for that individual.

So far, so good.

But there's also a sub-report that prints a summary line for the total for
each "account type" (for that same individual).

Both the main report and the sub-report use the same underlying query and
are linked together by the individual's internal number (so that the details
and the summary are always for the same person).

And that part works OK as well...

But the sub-report includes ***all data in the database*** for that
individual regardless of date!

Obviously, the SQL selection of the dates in that "where condition" is not
being taken into account.

What's the correct procedure for fixing this?

Bob.
 
Martureo said:
Using Access 2000, I create a report using the OpenReport method (within an
OnClick event on a form).

The main report prints details. Sorted in date sequence, this prints the
following three fields: date, "account type", and $ amount.

On the form, the user enters the starting date, the ending date, and the
individual's internal number.

The OpenReport method includes a "Where Condition" where I construct some
SQL to select the starting date, the ending date and the individual's
internal number.

The detail section of the report (which is in the main report) includes only
the data for that range of dates for that individual.

So far, so good.

But there's also a sub-report that prints a summary line for the total for
each "account type" (for that same individual).

Both the main report and the sub-report use the same underlying query and
are linked together by the individual's internal number (so that the details
and the summary are always for the same person).

And that part works OK as well...

But the sub-report includes ***all data in the database*** for that
individual regardless of date!

Obviously, the SQL selection of the dates in that "where condition" is not
being taken into account.


A limitation of the WhereCondition feature. Place the
criteria directly in both report's record source query.
 
Back
Top