I don't see any other way but to split the prefix text field (DA) from the suffix numeric field and group and sort by prefix and sort by number. What you're experiencing is what happens when you sort numbers as text data type. You can run an update query to split existing data into 2 new table fields but I'll bet this causes some kind of cascading re-designs. Then try something like
Code:
SELECT tblSorting.Prefix, tblSorting.Num
FROM tblSorting
GROUP BY tblSorting.Prefix, tblSorting.Num
ORDER BY tblSorting.Prefix, tblSorting.Num;
You'll get this
Prefix |
Num |
DA |
1 |
DA |
2 |
DA |
5 |
DA |
11 |
DA |
55 |
DA |
111 |
EM |
2 |
EM |
3 |
EM |
11 |
EM |
22 |
You concatenate a string that you want to see in your form or query: [Prefix] & "-" & [Num]
Could also do it in the sql that I posted. This will also make it MUCH easier to figure out the next num for a prefix should that be something you want to do.
Last edited by Micron; 10-28-2022 at 06:57 PM.
Reason: added info
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.