T
Ten Twenty via AccessMonster.com
Increment a Counter and reset it at some stage when the group change:
I wrote a powerlifting system but have run into some problems and it all boils down to reporting and queries. Although the system is in VB6 with an access database and the reporting done with the datareporter that ship with VB, the SQL statements should all be the same. A database with sample data can be found at http://www.reitzgh.co.za/add/database.mdb
My first problem comes from the statement below. It brings back data and pack a report BUT I just can not get it right to add a field that would contain the rank or position of the lifter: It should reset after the break in CDescription. Should I be able to solve this I guess that I will then be able to also complete the reports on the team positions.
My other problem with this statement, though I guess I will be able to live with it, is the sorting order of the CDescription field. A problem when one mix numeric and alfa. One would have liked to have the 100Kg right at the top. Currently it look like this:
LifterNumber Lastname Firstname CDescription GDescription EventName SubTotalA ScoreA
6 Man Spider 90Kg Male Benchpress 190 126.37
5 Doe John 82.5Kg Male Benchpress 172.3 115.68
3 Pompies Piet 82.5Kg Male Benchpress 142 95.48
1 Beneke Andre 70Kg Male Benchpress 87.3 72.29
4 Thomas Sue 56Kg Female Benchpress 137.5 168.91
8 Roetz Ilse 52Kg Female Benchpress 150 186.99
2 Archel Joan 52Kg Female Benchpress 135 168.29
7 Hulk Incredible 100Kg Male Benchpress 190 116.95
but would like to see it like this,
Rank LifterNumber Lastname Firstname CDescription GDescription EventName SubTotalA ScoreA
1 7 Hulk Incredible 100Kg Male Benchpress 190 116.95
1 6 Man Spider 90Kg Male Benchpress 190 126.37
1 5 Doe John 82.5Kg Male Benchpress 172.3 115.68
2 3 Pompies Piet 82.5Kg Male Benchpress 142 95.48
1 1 Beneke Andre 70Kg Male Benchpress 87.3 72.29
1 4 Thomas Sue 56Kg Female Benchpress 137.5 168.91
1 8 Roetz Ilse 52Kg Female Benchpress 150 186.99
2 2 Archel Joan 52Kg Female Benchpress 135 168.29
SELECT Lifter.LifterNumber AS LifterNumber, Lifter.Lastname AS Lastname, Lifter.Firstname AS Firstname, Class.Description AS CDescription, Activity.Description AS GDescription, Events.Name AS EventName, History.SubTotalA, History.WeightScoreA AS ScoreA
FROM Class, Lifter, Team, History, Meet, Activity, Events
WHERE (((Meet.MeetDate)=Date()) AND ((Class.uidClass)=[Lifter].[uidClassRef]) AND ((Lifter.uidTeamRef)=[Team].[uidTeam]) AND ((Lifter.uidLifter)=[History].[uidLifterRef]) AND ((Team.uidMeetRef)=[Meet].[uidMeet]) AND ((Lifter.Gender)=[Activity].
I wrote a powerlifting system but have run into some problems and it all boils down to reporting and queries. Although the system is in VB6 with an access database and the reporting done with the datareporter that ship with VB, the SQL statements should all be the same. A database with sample data can be found at http://www.reitzgh.co.za/add/database.mdb
My first problem comes from the statement below. It brings back data and pack a report BUT I just can not get it right to add a field that would contain the rank or position of the lifter: It should reset after the break in CDescription. Should I be able to solve this I guess that I will then be able to also complete the reports on the team positions.
My other problem with this statement, though I guess I will be able to live with it, is the sorting order of the CDescription field. A problem when one mix numeric and alfa. One would have liked to have the 100Kg right at the top. Currently it look like this:
LifterNumber Lastname Firstname CDescription GDescription EventName SubTotalA ScoreA
6 Man Spider 90Kg Male Benchpress 190 126.37
5 Doe John 82.5Kg Male Benchpress 172.3 115.68
3 Pompies Piet 82.5Kg Male Benchpress 142 95.48
1 Beneke Andre 70Kg Male Benchpress 87.3 72.29
4 Thomas Sue 56Kg Female Benchpress 137.5 168.91
8 Roetz Ilse 52Kg Female Benchpress 150 186.99
2 Archel Joan 52Kg Female Benchpress 135 168.29
7 Hulk Incredible 100Kg Male Benchpress 190 116.95
but would like to see it like this,
Rank LifterNumber Lastname Firstname CDescription GDescription EventName SubTotalA ScoreA
1 7 Hulk Incredible 100Kg Male Benchpress 190 116.95
1 6 Man Spider 90Kg Male Benchpress 190 126.37
1 5 Doe John 82.5Kg Male Benchpress 172.3 115.68
2 3 Pompies Piet 82.5Kg Male Benchpress 142 95.48
1 1 Beneke Andre 70Kg Male Benchpress 87.3 72.29
1 4 Thomas Sue 56Kg Female Benchpress 137.5 168.91
1 8 Roetz Ilse 52Kg Female Benchpress 150 186.99
2 2 Archel Joan 52Kg Female Benchpress 135 168.29
SELECT Lifter.LifterNumber AS LifterNumber, Lifter.Lastname AS Lastname, Lifter.Firstname AS Firstname, Class.Description AS CDescription, Activity.Description AS GDescription, Events.Name AS EventName, History.SubTotalA, History.WeightScoreA AS ScoreA
FROM Class, Lifter, Team, History, Meet, Activity, Events
WHERE (((Meet.MeetDate)=Date()) AND ((Class.uidClass)=[Lifter].[uidClassRef]) AND ((Lifter.uidTeamRef)=[Team].[uidTeam]) AND ((Lifter.uidLifter)=[History].[uidLifterRef]) AND ((Team.uidMeetRef)=[Meet].[uidMeet]) AND ((Lifter.Gender)=[Activity].
Code:
) AND ((Meet.uidEventsA)=[Events].[uidEvents]))
GROUP BY Lifter.LifterNumber, Lifter.Lastname, Lifter.Firstname, Class.Description, History.WeightScoreA, Activity.Description, Events.Name, History.SubTotalA, Lifter.Gender, Activity.Activity, Lifter.LifterStatus
HAVING (((Activity.Activity)='GenderStatus') AND ((Lifter.LifterStatus)=0))
ORDER BY Class.Description DESC , Lifter.Gender DESC , History.WeightScoreA DESC;