Share via

Problem with Primary Key sorting

Anonymous
2024-06-05T01:00:32+00:00

I'm working on a database for a class, and after making some adjustments to the data type in design view, my primary keys have gotten messed up. The primary keys will start with something like IP1, but instead of going to IP2, it instead goes to IP10. This will continue from IP10-IP19 until finally going to IP2. I understand that it is reading all the ones first, but how do I get this to change?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. ScottGem 68,830 Reputation points Volunteer Moderator
    2024-06-05T03:03:38+00:00

    Why are you using a key like that? A primary key has one and ONLY one purpose, to provide a unique identifier to a record. There is NO need for the PK to even be visible to a user.

    You seem to have a need to sort the records in some way. The esiest way to do that is to use an Autonumber as the PK and Another field as a visible identifier.

    If you can explain what this identifier is for, maybe we can help further

    Was this answer helpful?

    0 comments No comments
  2. DBG 11,711 Reputation points Volunteer Moderator
    2024-06-05T01:37:41+00:00

    Since you want to sort text as numbers, try addind a leading zero to your text numbers.

    Was this answer helpful?

    0 comments No comments