Requesting assistance with sorting

  • Thread starter subscription_junkie
  • Start date
S

subscription_junkie

I am working with a field that has four numbers. This is not an autonumber
field, but stores the employeeID in a long integer format.

I am needing the report to sort by THE LAST TWO NUMBERS of the Employee ID.
So, if I have 0041, 8576, and 4529, I would need them to sort like:

4529
0041
8576

I've searched the 'net and through my Access Bible and have not found a way
to do this. If anyone can provide any assitance, it would be greatly
appreciated.
 
S

Sandra Daigle

Add a calculated field to your query which is the Employeeid Mod 10 (Mod
returns the Remainder of X divided by Y). Then sort on this calculated
field:

SELECT MyTable.Employeeid , Mytable.[EmployeeID] Mod 100 AS SortField
FROM MyTable
Order By Mytable.[EmployeeID] Mod 100 ;
 

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