ordering records in subreport

K

Kathy Webster

I hope I can explain this clearly...

I have 2 reports. Each one uses the same subreport:
Report_A with Subreport_X
Report_B with Subreport_X

Report_A should have subreport_X sorted by date.
Report_B should have subreport_X sorted by lastname.
How can I write a macro to open Report_A and Report_B and sort properly?

TIA,
Kathy
 
N

NKTower

It's not done with a macro.

Open Report_A in design view.
Select Properties for Subreport_X
In the ORDER BY property, put [date]
ORDER BY is about the 3rd property on the ALL tab.
Save Report_A

Open Report_B in design view
Select PROPERTIES for Subreport_X
In ORDER BY property, put [lastname]
Save Report_B

The properties pages referencing Report_X are distinct to Report_A and
Report_B - they are not the same page.
 
D

Duane Hookom

I never use the order by property of a report. IMHO always use the Sorting
and Grouping dialog in the report design.
 
N

NKTower

Duane -
I *think* the OP was implying that she'd like to not have to maintain two
versions of the subreport, and only have two versions of the primary. But
isn't Sorting and Grouping a property of the "called" report object itself
rather than a property of the subreport object in the "calling" report? If
that's the case, then it isn't available from the main report's design view,
only from the subreport's design view.

So she probably has to resign herself to having two variants of the main
report, along with two corresponding variants of the subreport. Not a
terrible burden.

But having broached the subject, a question: Can you change sorting and
grouping of a subreport at run time from the "calling" report, or even some
form that will eventually launch the report? (i.e. open subreport acDesign,
acViewHidden etc.) I suspect not. If you can, I'd love to see an example.

Thanks,
Bruce
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top