show/sort report in the same order as sub-form?

A

Amit

MS Access 2K, Windows XP
====================
Hi,

I have an unbound form with 3 sub-forms that show results based on the
search criteria specified on the form. I also print a report (that has 3
sub-reports) from the same form based on the records shown in the sub-forms.

The sub-forms are in Datasheet view, and a user can sort the results by any
column (A-Z, or Z-A).

What I'd like to do is sort the report (or rather the sub-report based on
each sub-form) in the same order as the results in sub-form. So, for that,
I'll need to know the sort order for the subform and apply that to the
corresponding sub-report.

In the past on other forms-for-reports, I've had the user specify the sort
criteria using a combo-box on the form, so it was easy to use that for the
report, but I'm trying something different this time (without using a
combo-box), and not sure how to do this. Maybe it is easier to use
combo-boxes to specify sort criteria.

How do I find out the sort order for the subform (the field/control on which
the subform was sorted on by the user) if possible? Both the sub-forms and
the corresponding sub-reports have the same query as source, which does not
have a sort criteria specified.


Thanks for any help.

-Amit
 
M

Martin

You can read anything from within the subform by way of the following
(OrderBy is the sort order):

Forms![main form name]![subform name].Form.OrderBy
 

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