Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8588079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:43:35+00:00 2026-06-11T22:43:35+00:00

I am in Access 2010 and am trying to create a rank or row

  • 0

I am in Access 2010 and am trying to create a rank or row number field for a query which is ordered in a specific way. I have tried Rank: DCount("id","[Query1]","id <= " & [id]) but it ignores my Query’s sort, since the order is NOT as the ID Primary Key.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:43:36+00:00Added an answer on June 11, 2026 at 10:43 pm

    I’ve seen your sorting logic and it seems that I managed to produce a rank based upon it, by creating an additional query (Temp), with a column containing all the sorting function subproducts concatenated in it. The code for this query should look like this:

    SELECT Table1.Code1, 
        Len(Mid([Code1] & "",1,IIf(InStr([Code1] & "","*")>0,InStr([Code1] & "","*")-1,Len([Table1].[Code1] & "")))) 
        & Mid([Code1] & "",1,IIf(InStr([Code1] & "","*")>0,InStr([Code1] & "","*")-1,Len([Table1].[Code1] & ""))) & 
        Val(Mid([Code1] & "",InStr([Code1] & "","*")+1)) & 
        CStr(Val(Mid([Code1] & "",InStr([Code1] & "","*")+1))) AS OrderCode1
    FROM Table1
    ORDER BY Len(Mid([Code1] & "",1,IIf(InStr([Code1] & "","*")>0,InStr([Code1] & "","*")-1,Len([Table1].[Code1] & "")))), 
        Mid([Code1] & "",1,IIf(InStr([Code1] & "","*")>0,InStr([Code1] & "","*")-1,Len([Table1].[Code1] & ""))), 
        Val(Mid([Code1] & "",InStr([Code1] & "","*")+1)), 
        CStr(Val(Mid([Code1] & "",InStr([Code1] & "","*")+1))), Table1.Code1;
    

    After that, if you create a query over this additional one, and use the DCount function with the ‘OrderCode1’ column on the WHERE parameter, you should get a sequential rank. Something like this:

    SELECT Temp.Code1, DCount("Code1","[Temp]","OrderCode1 <= '" & [OrderCode1] & "'") AS Rank
    FROM Temp;
    

    If you are still needing a solution for this, you can check if it works!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried to configure alternate access mappings in my SharePoint 2010 which is
I'm trying to create a simple Word add-in. I have created a Word 2010
I am trying to launch an existing MS Access database (Access 2010) from a
Im trying to create an outlook 2010 addin. I just created the standard project,
i am trying to do a substring search from an access 2010 database in
I'm trying to access a subfolder of Inbox named subfolder in outlook (2010) using
I trying to create an application using vb 2010.This application handles booking of airline
I am trying to create a stored procedure using pass-through query in SQL Server
I'm trying to connect an Access DB (2010 32-bit) to a System ODBC connection
I'm using Microsoft SQL Svr Mgmt Studio 2008. I don't have access to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.