473,795 Members | 2,605 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
39 7141
OtheymAverian
23 New Member
I have everything modified so that the Query has the desired output. When I try to display the [Rank] field in my report I get an error message.

The help file lists the error as : Error 3612
Mar 8 '07 #11
Rabbit
12,516 Recognized Expert Moderator MVP
Multi-level GROUP BY clause is not allowed in a subquery. (Error 3612)
An SQL subquery cannot list more than one field in a GROUP BY clause.

Please post your SQL.
Mar 8 '07 #12
OtheymAverian
23 New Member
SELECT Temp.Date, Temp.Dealership , Temp.NewVehInv, Temp.[Total New Cost], Temp.[Total Holdback], Temp.WhsFinLiab , Temp.[Cash in Bank], Temp.ConInTrans , Temp.UsedVehInv , Temp.[Total Used Cost], Temp.Liability, Temp.[Retail New], Temp.[Retail Used], Temp.Wholesale, Temp.S7Score, Temp.Bonus, Temp.SP, Temp.[Entry Order], ((Select Count(*) from [Sales Report MTD] Where [S7Score] > [Temp].[S7Score];)+1) AS Rank
FROM [Sales Report MTD] AS Temp
ORDER BY Temp.Dealership ;



From our previous posts
Name = Dealership
Score = S7Score
Mar 8 '07 #13
Rabbit
12,516 Recognized Expert Moderator MVP
Try this, make a query that basically pulls everything from that query you just posted and base the report off that. Now, I'm not talking about a copy of the query, rather I'm talking about a query that SELECT * FROM query.

I think the problem is that the query is pulling data from both a table and a query.
Mar 8 '07 #14
OtheymAverian
23 New Member
Cannot edit my last reply for some reason.....

The error only shows up when I reference the [Rank] field in my report (in the details). I do not know if this will help you find the problem.

-Oth
Mar 8 '07 #15
Rabbit
12,516 Recognized Expert Moderator MVP
Cannot edit my last reply for some reason.....

The error only shows up when I reference the [Rank] field in my report (in the details). I do not know if this will help you find the problem.

-Oth
There's a 5 minute cutoff for edits.

Try out what I said in post #14 and let me know if that works.
Mar 8 '07 #16
OtheymAverian
23 New Member
If I make a query to pull all data from the previous query I get all 1's in my report.

The rank populates correctly if you just view the datasheet.

-Oth
Mar 8 '07 #17
Rabbit
12,516 Recognized Expert Moderator MVP
Okay, try making the query a Make Table query and base the report off it.
Mar 8 '07 #18
OtheymAverian
23 New Member
That worked perfectly. It kind of sucks to have to take the extra step to generate the table, but I am much further along than I was before I found you guys. Many many thanks.

-Oth
Mar 8 '07 #19
Rabbit
12,516 Recognized Expert Moderator MVP
I just tested it out and I see no reason why it shouldn't work. I used a more simplistic table with only 2 fields but otherwise the concept is the same.

I had a table with 2 fields.
I made a query based on the table that also adds a rank.
I made a report based on that query.

It all works, is this the same thing you did?

On a side note that may or may not have any bearing on the issue at hand. Don't name fields "Date" or "Name" or any other reserved keywords/properties/functions used by Access, it will confuse the two in certain situations and may confuse anyone else looking at the database.
Mar 8 '07 #20

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
4911
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
1379
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
2043
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
3181
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
1470
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
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10436
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...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9040
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
7538
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
6780
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
5436
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...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
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.