Sorting & Grouping options/expression

B

Brw

MS Access XP
Windows XP

MS Knowledgebase and Access help describes how to sort &
group records as follows:

"Open the report in Design view.
On the View menu, click Sorting and Grouping to display
the Sorting and Grouping dialog box.
In the first row of the Field/Expression column, select a
field name or type an expression"

What would my "expression" be if I wanted Access to ASK
the user which fields to sort by??

My goal: There are two fields that we equaly would like a
report made up and sorted by one field or the other
depending on our need. Rather than making two reports of
the same records, can I have it ask me which of these two
fields would you like to sort??? PS- I don't know coding.

Thank you in advance
Brw
 
A

Allen Browne

The user really needs to select from a combo box of the fields available
rather than trust them to know the field names and speil them "write". :)

That means you will use a form where they select the field to sort by. Then
in the Open event of the report, you can set the ControlSource of the
GroupLevel. Details:
http://allenbrowne.com/ser-33.html
 
S

Steve Schapel

Brw,

As an alternative to Allen's excellent method... I generally put an
Option Group on the form from which the report is launched, with an
option button for each of the fields which you want to give the choice
to sort by. Then, in the query that the report is based on, I put a
calculated field like this...
PrimarySort:
Choose([Forms]![FormName]![OptionGroupName],[FirstField],...,[NthField])
.... and then put PrimarySort in the report's Sorting & Grouping.
 

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