P
Philip Herlihy
My home-baked billing system generates invoices which are grouped by
date (month), with a text box in the group footer showing the Sum of
charges for each month.
One customer has now asked for invoices grouped by office location instead.
So, I've put a check-box on the form which launches the Invoice report,
and if the box is checked it launches a different report - different
only in that it has different subreports, as it's the subreports which
have the grouping. This all works; customer happy.
The problem with this is that I now have six reports to maintain (if
anything changes) rather than three. I did look for a way of EITHER
changing the grouping via VBA, OR switching the subreports using VBA.
One problem is that the group headers and footer need controls, and they
are different controls. I guess I could include all the controls and
make only the relevant ones visible? Maybe I could figure out a way of
doing without the header/footer controls, leaving only a need to switch
the grouping basis? Is that possible?
I did find code on the web which could select subreports dynamically:
http://www.accessmonster.com/Uwe/Forum.aspx/access-reports/8605/
Any-way-to-control-sub-reports#uUqsZuPQEHA3988tk2msftngp13phxgbl
... but that involves getting Access to change the form design in Design
View. "Live code" - eeek!
Is there a better way to achieve what I want - a report with a
group-based layout which is determined by run-time options? Or am I
just trying to be too neat?
Phil, London
date (month), with a text box in the group footer showing the Sum of
charges for each month.
One customer has now asked for invoices grouped by office location instead.
So, I've put a check-box on the form which launches the Invoice report,
and if the box is checked it launches a different report - different
only in that it has different subreports, as it's the subreports which
have the grouping. This all works; customer happy.
The problem with this is that I now have six reports to maintain (if
anything changes) rather than three. I did look for a way of EITHER
changing the grouping via VBA, OR switching the subreports using VBA.
One problem is that the group headers and footer need controls, and they
are different controls. I guess I could include all the controls and
make only the relevant ones visible? Maybe I could figure out a way of
doing without the header/footer controls, leaving only a need to switch
the grouping basis? Is that possible?
I did find code on the web which could select subreports dynamically:
http://www.accessmonster.com/Uwe/Forum.aspx/access-reports/8605/
Any-way-to-control-sub-reports#uUqsZuPQEHA3988tk2msftngp13phxgbl
... but that involves getting Access to change the form design in Design
View. "Live code" - eeek!
Is there a better way to achieve what I want - a report with a
group-based layout which is determined by run-time options? Or am I
just trying to be too neat?
Phil, London