Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 30th, 2003, 02:31 PM
Fallyhag Fallyhag is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 34 Fallyhag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 13 sec
Reputation Power: 5
Grouping records in a specific order

My database is as follows:

Rank............Surname

High.............Smith
High.............Bloggs
Medium........Carter
Low..............Blaine
High.............Copp
Medium........Bates


What I need is a report that will group all the records together under their ranks.

I have experimented with it but it groups in alphabetical order:

High
Low
Medium

How can I dictate the order of the group so that I get

High
Medium
Low

Is this possible? Many thanks in advance.

Fallyhag

Last edited by Fallyhag : October 30th, 2003 at 02:33 PM.

Reply With Quote
  #2  
Old October 30th, 2003, 02:36 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
Since there is no way of sorting them other than alphabetically, you could change them from words to numbers (High = 1, Med = 2, Low = 3) or just create another to hold that data.
Code:
Rank Table
Id   Name
1    High
2    Medium
3    Low

Surname Table
Rank     Surname
1           Smith
1           Bloogs
2           Carter
etc...

Reply With Quote
  #3  
Old October 30th, 2003, 02:43 PM
Fallyhag Fallyhag is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 34 Fallyhag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 13 sec
Reputation Power: 5
Thanks for the reply.

I like what you are saying, it makes sense. Is there a way of keeping my headings (High, Medium and Low) and assigning them values?

I have these ranks set up as a lookup field.

Fallyhag

Reply With Quote
  #4  
Old October 30th, 2003, 02:55 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Select [Rank Table].Name, [SurName Table].Surname from [Surname Table] INNER JOIN [Rank Table] ON [SurName Table].Rank = [Rank Table].ID
Order By [SurName Table].Rank;

This will bring the name of the Rank over and sort by rank ID

Reply With Quote
  #5  
Old October 30th, 2003, 02:57 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
You could just use that one table and add another column call RankID something like this (This violates table normalization rules)
Code:
Rank Table

RankID   Rank      Surname
1            High        Smith
1            High        Bloogs
2            Medium   Carter


The just do a select statement like this.
Code:
SELECT Rank, Surname
FROM Rank
ORDER BY RankID

Quote:
Results:
High Smith
High Blogs
High Copp
Medium Bates
Medium Carter
Low Blaine

Reply With Quote
  #6  
Old October 30th, 2003, 02:58 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Forgot

For this to work you need it to be a table, You can still have the reference to is as lookup, but reference the Rank Table instead of values


I would always recommend using lookup tables so when you need to change things you are only changing data and not code

Reply With Quote
  #7  
Old October 30th, 2003, 03:10 PM
Fallyhag Fallyhag is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 34 Fallyhag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 13 sec
Reputation Power: 5
Thumbs up

Many Many Thanks for the very fast and helpful replies.

Much appreciated. Now for the experimentation

All the best

Fallyhag


ps: Great Forum!

Reply With Quote
  #8  
Old October 30th, 2003, 04:49 PM
Fallyhag Fallyhag is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 34 Fallyhag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 13 sec
Reputation Power: 5
Well after a little hair pulling and playin around I solved it via the following solution:

Created the lookup with 2 columns.

Ist column had the rank and the 2nd had the numerical value.

I then gave the 2nd column zero cm width.

I could then sort the ranks in the report using the hidden numrical values.

Does this make sense or have I gone around the houses to sort a simple problem? Suggestions/advice welcome.

Fallyhag

Reply With Quote
  #9  
Old October 30th, 2003, 05:33 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
What ever works for you works. Ther is no one right way, there are ways that are better then others and ways that some prefer.

My preference is to not use lookup fields in the tables. I create a form that will have a combobox the is reference to another table where I will store the look values and then populate the fields this way and create a relationship between the two tables. I prefer using tables because if I ever have to add another item to my look up. All I have to do is add another record to one table and everything is done.

S-

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Grouping records in a specific order


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway