Elwin
Thanks for your advice. I think some of the code will help me over the next
hurdle however by trying to keep the description of my problem as simple as
possible I think I might have misled you. Assuming that a player has nine
results in the recordset, I thought I needed to copy the nine records
containing these results into another table for processing. The following
notes might help to shed further light the on the matter:
1. The fields contained within my recordset are 'ResultID', 'Date', 'Player'
, PlayersBand', 'Partner', 'PartnersBand' and 'Points'.
2. A 'Player' will have one of the following three bands - 'A', 'B' or 'V'
(for visitor).
3. In the processing table only the best six out of nine results will count.
4. Of these six results an 'A' band player must have a minimum of four
results with 'B' band partners.
5. The six results for 'B' band players may be achieved with any mix of 'A'
and 'B' band players.
6. Any result which either 'A' or 'B' band players achieve when partnering a
'V' band player, will attract a zero score.
7. If an 'A' or 'B' band player plays with the same partner more than once,
only the top score will count.
Having previously managed to do the above in Excel, via a mixture of 'on
sheet' calculations and VB code, I thought I'd try to achieve the same in
Access. Needless to say I'm not finding it easy.
Regards
Malcolm
Elwin said:
Here's a procedure that would work. You'd run it once for
each player. I can't debug it on the machine I'm on right
now, but it should be pretty close.
eg) ExtractInfo rsMyScores, "John"
Public Sub ExtractInfo(rsRead as DAO.Recordset, _
Player as string)
Dim strSQL
Dim rsWrite as DAO.Recordset
Dim intScore as Integer
Set rsWrite = CurrentDb.OpenRecordset _
("myTable",dbOpenDynaset, dbAppendOnly)
strSQL = "[Player]='" & Plyr & "'"
With rsRead
.FindFirst strSQL
If .NoMatch Then
Exit Sub
Else
Do Until .NoMatch
intScore = intScore + !Score
.FindNext strSQL
Loop
rsWrite.AddNew
rsWrite!Player = Plyr
rsWrite!TotalScore = intScore
rsWrite.Update
End If
End With
End Sub
-----Original Message-----
Folks
I have generated a procedure incorporating a DAO recordset which is based
upon a table and indexed to a field called 'Player'. The maximum number of
records for any player appearing in this recordset will be nine. What I now
need to do is to select out each player's set of results in turn so that
they may be separately processed. The end result of this processing should
give a player's name and score which then needs to be stored in a separate
table along with the results for all other players.
I would be grateful for any general advice on the way ahead.
Regards
Malcolm
.