andyakira
asked on
how do i do this, Ranking System
I have a database of names and scores. Heres how the list looks like:
Andy|55
Blah2|66
LOL|12
Shane|221
Mike|923
Gloria|222
The list has around 2,000 names|scores.
how can i make it set each user a rank by the score they have, like this:
Mike:Rank 1
Gloria:Rank 2
Shane:Rank3
Blah2:Rank4
Andy:Rank5
LOL:Rank6.
i want to seach for user Andy and have it show a rank of #5.
Andy|55
Blah2|66
LOL|12
Shane|221
Mike|923
Gloria|222
The list has around 2,000 names|scores.
how can i make it set each user a rank by the score they have, like this:
Mike:Rank 1
Gloria:Rank 2
Shane:Rank3
Blah2:Rank4
Andy:Rank5
LOL:Rank6.
i want to seach for user Andy and have it show a rank of #5.
ASKER
how does teh "SELECT * FROM work?
ASKER
is there another way of doing this without using sQL
You are using a database, but dont want to use any SQL?
ASKER
im not familiar with it, where can i go to learn more about sql?
Is your "database" just a text file?
If so, are we changing the file from this:
Andy|55
Blah2|66
LOL|12
Shane|221
Mike|923
Gloria|222
to this:
Mike:Rank 1
Gloria:Rank 2
Shane:Rank3
Blah2:Rank4
Andy:Rank5
LOL:Rank6
or do you want a second "database" text file containing this info?
Idle_Mind
If so, are we changing the file from this:
Andy|55
Blah2|66
LOL|12
Shane|221
Mike|923
Gloria|222
to this:
Mike:Rank 1
Gloria:Rank 2
Shane:Rank3
Blah2:Rank4
Andy:Rank5
LOL:Rank6
or do you want a second "database" text file containing this info?
Idle_Mind
ASKER
The file is a txt file that contains names:scores, i'm not trying to convery anything. just trying to find the rank of the user based on their score.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello Idle_Mind,
I'm getting a script out of range "ScoreL.AddItem Format(values(1), "000000000") & ", " & values(0)". do you know whats causing it
I'm getting a script out of range "ScoreL.AddItem Format(values(1), "000000000") & ", " & values(0)". do you know whats causing it
If a line in your text file is missing a "|" between the name and the score that could cause it.
Try changing your While...Wend loop to this and see if that fixes it:
While Not EOF(1)
Line Input #1, inputLine
If Instr(inputLine, "|") > 0 Then
values = Split(inputLine, "|")
List1.AddItem Format(values(1), "000000000") & ", " & values(0)
End If
Wend
Idle_Mind
Try changing your While...Wend loop to this and see if that fixes it:
While Not EOF(1)
Line Input #1, inputLine
If Instr(inputLine, "|") > 0 Then
values = Split(inputLine, "|")
List1.AddItem Format(values(1), "000000000") & ", " & values(0)
End If
Wend
Idle_Mind
ASKER
Thanks idle mind
"SELECT * FROM myTable ORDER BY scores DESC"
Do
i = i + 1
Loop Until recordset.Fields("name") = "Andy"
MsgBox "Rank = " & i