G
Guest
The code below is part of a race timing program in Access 2000.
The loops below are designed to post an overall "place" value for all race
participants of a certain gender (in this case - female), regardless of age
categories, etc. (i.e., 1st female, 2nd female, 3rd female, etc.) The code
retrieves the race bib # from the first record in the linked query
"qryLinkTime&Bib&RaceData2Mile(Female)" and then finds the same race bib # in
tblRaceData and adds a "1" in the fldPlace. Then it should go back to the
linked query, find the second record, retrieve the race bib#, and attach a
strPlace of "2" to the same race bib# in tblRaceData. . . and so on.
Lately the program has been acting erratic and not posting proper placings
or not entering fldPlace at all for certain records. I'm not sure what
changed. Perhaps someone can spot the breakdown in the loops? Or possibly
someone has a more elegant way to accomplish the same task?
Rick Mitchell
Springville, CA
'Adds "Place" for 2 Mile Females
Set rec = db.openrecordset("qryLinkTime&Bib&RaceData2Mile(Female)")
rec.MoveFirst
strPlace = 0
Do Until rec.EOF() = True
strBib = rec("fldBib")
strPlace = strPlace + 1
Set rec = db.openrecordset("tblRaceData")
rec.MoveFirst
Do Until rec.EOF = True
If rec("fldBib") = strBib Then
rec.edit
rec("fldPlace") = strPlace
rec.Update
GoTo LabelPlace2
End If
rec.MoveNext
Loop
LabelPlace2:
Set rec = db.openrecordset("qryLinkTime&Bib&RaceData2Mile(Female)")
rec.MoveFirst
Do Until rec.EOF() = True
If rec.RecordCount = strPlace Then
rec.MoveNext
GoTo LabelNumber2
End If
rec.MoveNext
Loop
LabelNumber2:
Loop
The loops below are designed to post an overall "place" value for all race
participants of a certain gender (in this case - female), regardless of age
categories, etc. (i.e., 1st female, 2nd female, 3rd female, etc.) The code
retrieves the race bib # from the first record in the linked query
"qryLinkTime&Bib&RaceData2Mile(Female)" and then finds the same race bib # in
tblRaceData and adds a "1" in the fldPlace. Then it should go back to the
linked query, find the second record, retrieve the race bib#, and attach a
strPlace of "2" to the same race bib# in tblRaceData. . . and so on.
Lately the program has been acting erratic and not posting proper placings
or not entering fldPlace at all for certain records. I'm not sure what
changed. Perhaps someone can spot the breakdown in the loops? Or possibly
someone has a more elegant way to accomplish the same task?
Rick Mitchell
Springville, CA
'Adds "Place" for 2 Mile Females
Set rec = db.openrecordset("qryLinkTime&Bib&RaceData2Mile(Female)")
rec.MoveFirst
strPlace = 0
Do Until rec.EOF() = True
strBib = rec("fldBib")
strPlace = strPlace + 1
Set rec = db.openrecordset("tblRaceData")
rec.MoveFirst
Do Until rec.EOF = True
If rec("fldBib") = strBib Then
rec.edit
rec("fldPlace") = strPlace
rec.Update
GoTo LabelPlace2
End If
rec.MoveNext
Loop
LabelPlace2:
Set rec = db.openrecordset("qryLinkTime&Bib&RaceData2Mile(Female)")
rec.MoveFirst
Do Until rec.EOF() = True
If rec.RecordCount = strPlace Then
rec.MoveNext
GoTo LabelNumber2
End If
rec.MoveNext
Loop
LabelNumber2:
Loop