David:
What you trying to do is quite complex and I do not know the specifics of
your implementation, so my comments here are meant in a general sense.
In the KB "how to" you refer to, the recordset for the dynamic crosstab is
generated in the Report Open event, which unless you are opening and closing
the report/subreport for each group member, the recordset will be generated
the first time the subreport is open and the activities associated with that
particular group member will remain for subsequent group members.
What needs to happen is to regenerate the recordset (which will update the
field names for Activities) for each group member. Depending on how your
report/subreport is setup, you may be able to do this in a PageHeader or
GroupHeader event. You may, although I have not tested this, simply be able
to call the Report_Open event procedure for the subreport from one of these
event procedures, but the general idea is to update the recordset behind the
dynamic crosstab subreport for each group member.
--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com
This response is supplied "as is" without any representations or warranties.
<de********@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi
I've created a crosstab query and displayed it as a sub-report in my
main report. This is fine until the data changes and the column names
become incorrect. I know I have to create a 'dynamic crosstab query'
but I don't know how to!! I've read the "How to..." on the Microsoft
site but it mainly gives an example rather than explain the basics,
which I can't work out.
My context is:
I'm developing an end of year 'Group Member' report for school students
in PE.
Crosstab Query "qryTest" shows [Group Member ID] as the row and then
[Activity] as columns with an [Activity Attainment] as the value. The
activities vary for each group member and can be more or less.
I wish to include this as a sub-report "rptTest" in my main report
linked to the [Group Member ID]. My main report includes other
performance information such as Effort Grades etc and is working fine.
The main report will be previewed from a "frmStudentPerformance" form
and is linked from the [Group Member ID] field on that form. Like I
said- I can get this to work fine as a normal cross-tab report but once
the [Activity] changes between Group Members it falls down.
Regards
David