473,785 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding a Rank column to a report

23 New Member
Using Access '02, Windows XP Pro SP2

I have a Report that Contains data that is sorted by name and have been asked to add a field that would output a rank based on a numerical (currency) field.

Example Report structure as it is now (dashes added for spacing purposes)

Name-----------Score
----------------------------
ABC------------------10
BCD------------------25
CDE--------------------5

Example Report Structure needed

Rank------Name--------------Score
------------------------------------------
---2---------ABC-------------------10
---1---------BCD-------------------25
---3---------CDE-------------------5

I just started my adventure into Access a few weeks ago and have no SQL knowledge. I have attempted to make a query to pull data, resort, and number, but I have been unable to get my head around some of the comcepts. I do not know if it is possible to add a field into a query that would auto count a rank (based on the query being sorted by the Score field)
Mar 7 '07 #1
39 7139
Rabbit
12,516 Recognized Expert Moderator MVP
Are you going to sort by rank on the report?
Mar 7 '07 #2
OtheymAverian
23 New Member
No I am not. The report will still continue to be sorted by name. But I need the records ranked as if they were sorted by score.
Mar 7 '07 #3
OtheymAverian
23 New Member
Is there any way to do this at all with Access functions, or do I have to lears SQL soon?
Mar 8 '07 #4
Rabbit
12,516 Recognized Expert Moderator MVP
Expand|Select|Wrap|Line Numbers
  1. SELECT Temp.Score,Temp.Name, ((Select Count(*) from TableName Where [Score] > [Temp].[Test];)+1) AS Rank
  2. FROM TableName AS Temp
  3. ORDER BY Temp.Name;
Mar 8 '07 #5
OtheymAverian
23 New Member
Thank you for the code, I am attempting to enter it now but have one question. You refer to a [Test] field at the end of the first line. I am unsure what this refers to, when I enter it in I am prompted to enter a value for [Test].

Also I apologize for the double post. I was a little anxious this morning, and thought I may be able to rephrase what I needed better.
Mar 8 '07 #6
Rabbit
12,516 Recognized Expert Moderator MVP
Sorry. I forgot to rename it. I was testing the SQL using different fields names. [Test] should be [Score] and you'll have to put your Table Name in place of TableName
Mar 8 '07 #7
OtheymAverian
23 New Member
I also put my table name in place of the [Temp] tag. Is this correct? I get all 1's when i use [Score] in place of [Test]
Mar 8 '07 #8
Rabbit
12,516 Recognized Expert Moderator MVP
No, leave the [Temp] tags alone, they're used as an alias. Only change [Test] to [Score] and TableName to your table's name.
Mar 8 '07 #9
OtheymAverian
23 New Member
This got the ranking field working almost exactly as I am looking for! The table contains data that many months worth of data. I use the line

WHERE (((Month([Temp].[Date]))=Month(Date()-28)))

to limit the query to the most recent month (working with data that is a month old always).

The line of code creates a ranking for the entire table and then the results are limited to the most recent month, leaving me with weird rankings (6,8,12,17,21, etc.) but I think i just need to base this query off a query that limita the data set prior to the ranking.

-Oth
Mar 8 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1480
by: David Shadovitz | last post by:
I need to add a column to a table. This table holds several thousand records, has several indexes, and serves as the parent table to a few child tables. When I've done this in the past, it has taken quite a long time for the ALTER TABLE command to complete. So, what is the correct procedure for adding a column? Drop the indexes, add the column, and recreate the indexes?
2
1988
by: Chris Cobb | last post by:
I have a table that currently contains 718000 rows. I wish to add a column to the table. Adding this column anywhere other than the end of the table requires exporting data, a drop and recreate, then a re-import of data. Is there any disadvantage to adding this column to the end of the table. Will this fragment the table. Is a reorg needed? Thanks, - CBC
3
4910
by: Raj | last post by:
Hi, I am trying to add some more information to the table which already has a lot a data (like 2-3000 records). The new information may be adding 2-3 new columns worth. Now my questions are: (1)Is it a good idea to add new columns to the existing table? then it will create these new columns for all old records, will it not result in wasting a lot of space?? (2)Is it a good idea to create a new table with the new information and have as a...
0
1378
by: Nunya Biznas | last post by:
I have a two column report that needs to have the word "continued" appear at the top of the 2nd column if the detail records are part of the group from the previous column. I have tried using a hidden text box and set running sum to 'over group' and tested the value of this box to unhide the "continued" box in my header. This works when I go to a new page but not to a new column. HELP!
2
2041
by: dSchwartz | last post by:
I need help adding a column to a dataset, but its a little bit more complicated then just that. Here's the situation: I have many xml files in one directory, each which represent a newsletter. I want to create a page that will display a title and date of each newsletter, along with a link to it. here's a code snip: ============================= DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath("/newsletters/xml/"));
1
3180
by: bennett | last post by:
I have a table with about 100,000 records whose description is: +-----------------------+----------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------------+----------------------+------+-----+---------+----------------+ | ID | int(10) unsigned | | PRI | NULL | auto_increment | | url ...
1
1469
by: Markw | last post by:
Hi folks, I probably used the term 'report' incorrectly. Sorry for that in advance. The below code produces a 2 column web page that shows in the first column a picture and the 2nd column shows the person's name and address ad a few other things. What I would like is to change this into a 4 column report with no duplication. Could somebody help me with this, I'm sure it's simple enough but when your new to programming it all looks...
2
1712
by: TSGB | last post by:
Hi all, I need to make a report and to save space I need to be able to display the title(label) in a column report just once per page. Ex. Result from record 1 Result from record 2 Result from record 3 TITLE1 a b c TITLE 2 d f g . ...
2
1691
by: rfdjr1 | last post by:
I'm using MS Access 2000. I have a small database to keep track of my lighthouse collection. Right now it's only two columns. I'd like to add a third. I'd like the new column to be the third column, that is, to the right of the others. Every time I try to insert a column, it ends up on the far left or in between the two existing columns. How do I add one on the right? Thanks.
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.