473,795 Members | 3,386 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 7143
NeoPa
32,579 Recognized Expert Moderator MVP
Do you currently have code that executes your action query(s)?
Or do you run them manually?
Mar 9 '07 #31
OtheymAverian
23 New Member
I was running them manually until earlier today. Today I made a form that had buttons that initiate the reports.

The query in question is ran when a specific report is opened. (On Open event)

-Oth
Mar 9 '07 #32
NeoPa
32,579 Recognized Expert Moderator MVP
If you post the code for your OnOpen event I'll show you where to put the extra lines.
Don't forget to use [code] tags.
Mar 9 '07 #33
NeoPa
32,579 Recognized Expert Moderator MVP
Actually, post the code for the button that opens the report as well as the OnOpen event procedure of the report and we'll have a look at what's going on exactly.
Mar 9 '07 #34
OtheymAverian
23 New Member
Are you talking VBA code? I am using the On Open field in the properties box when viewing the report in design mode (selecting report from the drop down box). As far as I can see there is not VBA code for the report.

I think this is what you want for the button :
Expand|Select|Wrap|Line Numbers
  1. Private Sub SalesNetMTDReport_Click()
  2. On Error GoTo Err_SalesNetMTDReport_Click
  3.  
  4.     Dim stDocName As String
  5.  
  6.     stDocName = "Sales Net MTD"
  7.     DoCmd.OpenReport stDocName, acPreview
  8.  
  9. Exit_SalesNetMTDReport_Click:
  10.     Exit Sub
  11.  
  12. Err_SalesNetMTDReport_Click:
  13.     MsgBox Err.Description
  14.     Resume Exit_SalesNetMTDReport_Click
  15.  
  16. End Sub
Mar 9 '07 #35
OtheymAverian
23 New Member
I put the 2 lines of code in before and after the report was called and it ran without posting the warnings. I think I got it.

-Oth
Mar 9 '07 #36
NeoPa
32,579 Recognized Expert Moderator MVP
Thanks for the VBA routine posted. That is pretty standard so no problems there.
I don't really understand what you're saying about the OnOpen event procedure of the report so let's try this instead :
  1. From the main database window select Reports.
  2. Select the report called [Sales Net MTD].
  3. Open it for Design.
  4. Make sure the Properties pane is open (Alt-Enter).
  5. Go down to the 'On Open' property.
  6. Select [Event Procedure].
  7. Click on the elipsis button (...).
  8. When the VBA code window opens just Copy (Ctrl-C) and Paste (Ctrl-V) the whole lot into a post here.
Mar 9 '07 #37
NeoPa
32,579 Recognized Expert Moderator MVP
I put the 2 lines of code in before and after the report was called and it ran without posting the warnings. I think I got it.

-Oth
That may work sometimes but is not the correct place.
Post me the other code and I'll show you the proper place :)
Mar 9 '07 #38
OtheymAverian
23 New Member
OH!! I wrote a tiny little macro that called the query and then called that macro in the 'On Open'. If i view the code for the report there is none. I assume it is because I am calling a macro and not a query directly.

-Oth
Mar 9 '07 #39
NeoPa
32,579 Recognized Expert Moderator MVP
In that case you have two options :
  1. Leave the code as you already have it.
  2. Explore in the macro options for the command, for a setting which disables those messages
I would recommend using just VBA code in a database. Mixing the two means that you need to understand both. There's nothing I'm aware of that can be done in a macro but not in code.
Mar 9 '07 #40

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
3182
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
1692
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
10214
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...
1
10164
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,...
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
5437
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...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.