sort order

G

Guest

In Sorting & Grouping how can I set the Sort Order for the field [Rotation]
so that the values sort:

None
Some
All

Thanks!
 
G

Guest

Hi, Duane!

I went with the less pure method. The field will only ever have 1 of the 3
possible values so I threw flexibility out the window.

How could I have found "Instr" if not here? I can never seem to find HOW to
code something in the Help files or Access books.

--
www.Marzetti.com


Duane Hookom said:
IMHO the pure method is to add a field to your table of unique rotations that
describes the order:
tblRotations
Rotation SortOrder
None 1
Some 2
All 3
You can then add this table to your report's record source and sort by the
SortOrder field.

A much less flexible method is to set your Sorting and Grouping expression to:
=Instr("None Some All", [Rotation])

--
Duane Hookom
Microsoft Access MVP


JohnLute said:
In Sorting & Grouping how can I set the Sort Order for the field [Rotation]
so that the values sort:

None
Some
All

Thanks!
 
A

Allen Browne

The simplest solution would be to create a table with 2 fields, and populate
it with 3 records:
RotationNum Rotation
1 None
2 Some
3 All
You can now include this table in the report's query, and sort on
RotationNum.

If that is not possible, you could add a calculated field to the report's
source query use Switch() or nested IIf() expressions to generate the
sorting number (1, 2, or 3.)
 
G

Guest

IMHO the pure method is to add a field to your table of unique rotations that
describes the order:
tblRotations
Rotation SortOrder
None 1
Some 2
All 3
You can then add this table to your report's record source and sort by the
SortOrder field.

A much less flexible method is to set your Sorting and Grouping expression to:
=Instr("None Some All", [Rotation])
 
G

Guest

You need to think "out of the box". Take everything you know about Access and
expressions. Quickly filter out the stuff that might not pertain while
returning stuff that might help.

I wish I had $10 for every time a client stated "The field will only ever
have 1 of the 3 possible values" ;-) I prefer to maintain data rather than
expressions.


--
Duane Hookom
Microsoft Access MVP


JohnLute said:
Hi, Duane!

I went with the less pure method. The field will only ever have 1 of the 3
possible values so I threw flexibility out the window.

How could I have found "Instr" if not here? I can never seem to find HOW to
code something in the Help files or Access books.

--
www.Marzetti.com


Duane Hookom said:
IMHO the pure method is to add a field to your table of unique rotations that
describes the order:
tblRotations
Rotation SortOrder
None 1
Some 2
All 3
You can then add this table to your report's record source and sort by the
SortOrder field.

A much less flexible method is to set your Sorting and Grouping expression to:
=Instr("None Some All", [Rotation])

--
Duane Hookom
Microsoft Access MVP


JohnLute said:
In Sorting & Grouping how can I set the Sort Order for the field [Rotation]
so that the values sort:

None
Some
All

Thanks!
 
G

Guest

Thanks, Allen!

--
www.Marzetti.com


Allen Browne said:
The simplest solution would be to create a table with 2 fields, and populate
it with 3 records:
RotationNum Rotation
1 None
2 Some
3 All
You can now include this table in the report's query, and sort on
RotationNum.

If that is not possible, you could add a calculated field to the report's
source query use Switch() or nested IIf() expressions to generate the
sorting number (1, 2, or 3.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

JohnLute said:
In Sorting & Grouping how can I set the Sort Order for the field
[Rotation]
so that the values sort:

None
Some
All

Thanks!
 
G

Guest

You need to think "out of the box". Take everything you know about Access
and
expressions. Quickly filter out the stuff that might not pertain while
returning stuff that might help.

The problem is that everything I know doesn't add up to much!
I wish I had $10 for every time a client stated "The field will only ever
have 1 of the 3 possible values" ;-) I prefer to maintain data rather than
expressions.

I'm very sensitive to "ever" and "never". In this case it's absolutely true.
"Rotation" can only ever be None, Some, or All therefore it's more efficient
maintain an expression.

I'll be more than happy to send you $10 if it ever changes!
 

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