ADO Recordset

kuifje_007

Registered User.
Local time
Today, 07:36
Joined
Nov 1, 2004
Messages
17
I don´t know why this Recordset doesn´t work. It won´t write down to the table tblPrediction. Maybe you know why?
I have many comboboxen, which is called cboPlayer1, cboPlayer2, and so on.


Function WritedownToTable()

Dim rst As New ADODB.Recordset
Set rst.ActiveConnection = CurrentProject.Connection
Dim intAantalSpelers As Integer

rst.CursorType = adOpenStatic
rst.LockType = adLockOptimistic
rst.Source = "SELECT name_ID, round, winner FROM tblPrediction"
rst.Open

While Not rst.EOF
intNumberPlayers = 1
[Forms]![frmPrediction]![naam] = rst!naam
[Forms]![frmPrediction]("cboPlayer" & Trim(Str(intNumberPlayers))) = rst!Winner
intNumberPlayers = intNumberPlayers + 1
rst.MoveNext

Select Case intNumberPlayers

Case 65 To 96: rst("Round") = "2nd"

Case 97 To 112: rst("Round") = "3rd"

Case 113 To 120: rst("Round") = "QF"

Case 121 To 124: rst("Round") = "SF"

Case 125 To 126: rst("Round") = "F"

Case 127: rst("Round") = "W"

End Select

Wend

'Forms("frmPrediction").Refresh


rst.Close
Set rst = Nothing

End Function
 
intNumberPlayers = 1

this is in the wrong spot. move it above the while line
 
Look at doing this a different way.
You shouldnt have 2 combo boxes for the same thing.
I think you need to do some normalization(?)
 
Thank you for the reply.

Crilen007, I need that comboboxes to select the players from the one to the other rounds (first, second, quarterfinal, semifinal and final).
I am making a tennis program with the elimination rounds.
 
There are better ways. IE, have a combo box with a player, and another with round. That would be more normalized.
 
What do you suggest then? I don´t understand you.
Don´t you think it is possible to write down the names of the winner in every round?
 

Attachments

Users who are viewing this thread

Back
Top Bottom