Solved I am new to Access - don't shoot. Looking for sorting help on a Table (1 Viewer)

Bosquetia

New member
Local time
Today, 06:54
Joined
Feb 21, 2024
Messages
3
I work at an airport. I am trying to help them with their data by using Access. We have about 150 hangars. Some have numbers only others have letters and numbers (ex: T-24). The hangars are unique so I'd like to make the hangar the ID Field but how can I sort so all the J's, all the T's are together and the numbers go from 1-100 in order. Is it even possible?
 

plog

Banishment Pending
Local time
Today, 05:54
Joined
May 11, 2011
Messages
11,646
2 fields per "hangar number". Letters in their own field, numbers in their own field.

If you jam both letters and numbers together the "numbers" won't sort as numbers, they will sort as text:

Numbers As Numbers Sort Like This: 1, 2,3,...10,11,12...20,21,22...
Numbers As Strings Sort Like This: 1, 10, 11, 12, ...2, 20, 21, 22...

Store your "hangar number" in 2 fields.
 

Steve R.

Retired
Local time
Today, 06:54
Joined
Jul 5, 2006
Messages
4,687
The hangars are unique so I'd like to make the hangar the ID Field ...
Do not use the hangers ID as the primary key. The name of a hanger may change in the future. Just create a regular text field called "hangername" to hold the hangers ID.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:54
Joined
Sep 21, 2011
Messages
14,303
Do not use the hangers ID as the primary key. The name of a hanger may change in the future. Just create a regular text field called "hangername" to hold the hangers ID.
Yes, I always preferred autonumber as ID fields.
 

LarryE

Active member
Local time
Today, 03:54
Joined
Aug 18, 2021
Messages
591
Save yourself a lot grief. Use an AutoNumber as your Primary Key and use a text field to store your hanger identifiers.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:54
Joined
Feb 19, 2002
Messages
43,275
Save yourself a lot grief. Use an AutoNumber as your Primary Key and use a text field to store your hanger identifiers.
Correct. But, you still need a composite unique index on the combination of the two fields. Use the indexes dialog to create it. You cannot create a two-column index using the table interface itself.
 

Users who are viewing this thread

Top Bottom