special sort

  • Thread starter Thread starter Megaton
  • Start date Start date
M

Megaton

Hello, is it possible to sort something like this?

XS, S, M, L, XL, XXL

if so, how?

Thank you.
 
Hello, is it possible to sort something like this?

XS, S, M, L, XL, XXL

if so, how?

Thank you.

Assign numeric values to the size values. Put them in a table
(
NumericSize INTEGER
, LetterSize TEXT(3)
)

Then you can sort by NumericSize and show LetterSize
 
Hi Megaton,

I think the easiest way to accomplish this sort is to have the sizes in a
separate lookup table, one record for each size, and then add a numeric
SortOrder field to this same lookup table. Bring this table into any queries
where you need to sort.

So, the question is do you already have a sizes table? If not, create one
and set the size field as the primary key:

tblSizes
pkSize (Text / 3 Primary key)
SortOrder (Number / Integer --->Remove default value of 0)


Enter six records into this table:

pkSize SortOrder
XS 1
S 2
M 3
L 4
XL 5
XXL 6

Create a relationship with enforced referential integrity between pkSize in
this new table and the corresponding foreign key size field in your main
table.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
 
Very helpful. Thank you so much.

Tom Wickerath said:
Hi Megaton,

I think the easiest way to accomplish this sort is to have the sizes in a
separate lookup table, one record for each size, and then add a numeric
SortOrder field to this same lookup table. Bring this table into any queries
where you need to sort.

So, the question is do you already have a sizes table? If not, create one
and set the size field as the primary key:

tblSizes
pkSize (Text / 3 Primary key)
SortOrder (Number / Integer --->Remove default value of 0)


Enter six records into this table:

pkSize SortOrder
XS 1
S 2
M 3
L 4
XL 5
XXL 6

Create a relationship with enforced referential integrity between pkSize in
this new table and the corresponding foreign key size field in your main
table.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
 
Back
Top