help plz...

  • Thread starter marco_pb via AccessMonster.com
  • Start date
M

marco_pb via AccessMonster.com

I have a question, I want to rank records based on the score.
example..
I have a form which contain these data:
Name Score
A 50
B 75
C 25

another form is to review:
Name score rank
C 25 (I want it to be automatically 1)
A 50 (I want it to be automatically 2)
B 75 (I want it to be automatically 3)

how can i do that?
please, I really need your help. I am a noob in using MS. Access 2003.
thank you in advance for your consideration to help..
 
B

BruceM

One way is to base the form on a query, and sort by score. If the form is
now based on a table, just make a query that includes all of the fields from
the table. In the query design grid, click Ascending in the Order By row
for the Score field. Use the query as the form's record source.
If you are storing the same names over and over you may want to rethink your
design.
 
M

marco_pb via AccessMonster.com

Thank you for answering..
That is just an example. I just want to know how to do the automatic ranking..

I know the sorting, but my question is how to make a rank (to put number 1,2,
2 in a blank column) after sort.

thank you again in advance
One way is to base the form on a query, and sort by score. If the form is
now based on a table, just make a query that includes all of the fields from
the table. In the query design grid, click Ascending in the Order By row
for the Score field. Use the query as the form's record source.
If you are storing the same names over and over you may want to rethink your
design.
I have a question, I want to rank records based on the score.
example..
[quoted text clipped - 13 lines]
please, I really need your help. I am a noob in using MS. Access 2003.
thank you in advance for your consideration to help..
 
M

Marshall Barton

marco_pb via AccessMonster.com said:
I have a question, I want to rank records based on the score.
example..
I have a form which contain these data:
Name Score
A 50
B 75
C 25

another form is to review:
Name score rank
C 25 (I want it to be automatically 1)
A 50 (I want it to be automatically 2)
B 75 (I want it to be automatically 3)

how can i do that?
please, I really need your help. I am a noob in using MS. Access 2003.


This requires a subquery in the form's record source query.
The calculated field would be like:

Rank: (SELECT Count(*) FROM table As X WHERE X.score <=
table.score)
 
M

marco_pb via AccessMonster.com

Thank you for your reply..
I am really sorry, but I can not get the solution I want.
I dont understand the code you have given me. Would u mind explain it a bit?
FYI, The table name is E-Test, and the rank is based on total_score
thank you in advance.

Marshall said:
I have a question, I want to rank records based on the score.
example..
[quoted text clipped - 12 lines]
how can i do that?
please, I really need your help. I am a noob in using MS. Access 2003.

This requires a subquery in the form's record source query.
The calculated field would be like:

Rank: (SELECT Count(*) FROM table As X WHERE X.score <=
table.score)
 
M

Marshall Barton

Rank: (SELECT Count(*) FROM [E-Test] As X
WHERE X.[total_score] <= [E-Test].[total_score])

If the names are right, then you should be able to just copy
the above and paste it into a blank field in your form's
record source query.
--
Marsh
MVP [MS Access]


marco_pb via AccessMonster.com said:
I am really sorry, but I can not get the solution I want.
I dont understand the code you have given me. Would u mind explain it a bit?
FYI, The table name is E-Test, and the rank is based on total_score
thank you in advance.

Marshall said:
I have a question, I want to rank records based on the score.
example..
[quoted text clipped - 12 lines]
how can i do that?
please, I really need your help. I am a noob in using MS. Access 2003.

This requires a subquery in the form's record source query.
The calculated field would be like:

Rank: (SELECT Count(*) FROM table As X WHERE X.score <=
table.score)
 
M

marco_pb via AccessMonster.com

Thank you, It works in a query, but how can i make it in a form?
thank you in advance

Marshall said:
Rank: (SELECT Count(*) FROM [E-Test] As X
WHERE X.[total_score] <= [E-Test].[total_score])

If the names are right, then you should be able to just copy
the above and paste it into a blank field in your form's
record source query.
I am really sorry, but I can not get the solution I want.
I dont understand the code you have given me. Would u mind explain it a bit?
[quoted text clipped - 12 lines]
 
M

marco_pb via AccessMonster.com

Thank you, It works in a query, but how can i make it in a form?
thank you in advance

and one more point, the query only display the first row.. so i want to make
it in a form, and later on copy the value to the field i had in a table, so
that after i call in nquery, it shows all records.
thank you again in advance, hope i can make it in a query
 
M

marco_pb via AccessMonster.com

sorry, forgot tell u that i have tried to put the query u gave me in a form
i made a new textbox and paste the query in the record source of that new
textbos. Rank: (SELECT Count(*) FROM [E-test] As X WHERE X.[total_score] <=
[E-test].[total_score);
 
M

Marshall Barton

marco_pb via AccessMonster.com said:
sorry, forgot tell u that i have tried to put the query u gave me in a form
i made a new textbox and paste the query in the record source of that new
textbos. Rank: (SELECT Count(*) FROM [E-test] As X WHERE X.[total_score] <=
[E-test].[total_score);


This question is bouncing all over the place. Text boxes do
not have a record source property. If you meant to say
Control Source property, then you need to know that you can
not use a query as a control source.

Furthermore, this kind of thing is dependent on the records
that are selected by the query's WHERE clause.
Because that may change every time you run the query, it
doesn't make any sense to save the rank number in the table.
Even if you eliminate the where clause and update every
record in the table, the rank field can still become invalid
as soon as you add a new record or edit or delete an
existing record.

The query I thought you were looking for was supposed to be
used as the **form's** Record Source. And even then it is
only good for a quick calculation of something you should be
able to visually figure out by looking at the data in a form
or report.

You need to back off a little and think this through before
you spend a lot of time implementing something that will not
hold together in real situations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top