special sort

M

Megaton

Hello, is it possible to sort something like this?

XS, S, M, L, XL, XXL

if so, how?

Thank you.
 
P

pietlinden

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
 
T

Tom Wickerath

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/
__________________________________________
 
M

Megaton

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/
__________________________________________
 

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