VB 6 Enterprise Edition
I am getting the error message "rowset does not support fetching backward" when I try to do "recordset.movelast". I have read in other post that I am apparently using a "read forward only" recordset but I don't know how to fix it. I was under the understanding that "CursorType" is the culprit. Doesn't "adOpenKeyset" allow direction in all ways?
Please help if you can. Below in my code. These routines ar in a BAS module:
On the Form in the Form_Load event, I have the following code:
Here is the code that is causing the problem:
I am getting the error message "rowset does not support fetching backward" when I try to do "recordset.movelast". I have read in other post that I am apparently using a "read forward only" recordset but I don't know how to fix it. I was under the understanding that "CursorType" is the culprit. Doesn't "adOpenKeyset" allow direction in all ways?
Please help if you can. Below in my code. These routines ar in a BAS module:
Code:
Public Sub OpenConnections()
Set pconSports = New ADODB.Connection
pconSports.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\Program Files\FootballPool\Sports.mdb;Persist Security Info=False"
'ReportPath = App.Path
pconSports.Open
End Sub
Code:
Public Sub OpenWeekWinners()
On Error GoTo ErrHandler
Set pcmdWeekWinners.ActiveConnection = pconSports
pcmdWeekWinners.CommandType = adCmdTable
pcmdWeekWinners.CommandText = "WeekWinners"
Set rstWeekWinners = New ADODB.Recordset
rstWeekWinners.LockType = adLockOptimistic
rstWeekWinners.CursorLocation = adUseClient
rstWeekWinners.CursorType = adOpenKeyset
rstWeekWinners.Open pcmdWeekWinners
Exit Sub
ErrHandler:
Call MsgBox(Err.Description, vbCritical, "OpenAWeekWinners")
End Sub
Code:
call OpenConnections
Call OpenWeekWinners
Code:
SQL = "Select * from WeekWinners where PoolPlayer = '" & lblPlayerName(Counter).Caption & "' "
SQL = SQL & "order by WeekNumber ;"
Set rstWeekWinners = pconSports.Execute(SQL)
If rstWeekWinners.EOF And rstWeekWinners.BOF Then
lblAccumulative(HoldPlayerCount) = 0
Else
[B][I][U]rstWeekWinners.MoveLast[/U][/I][/B]
lblAccumulative(HoldPlayerCount).Caption = rstWeekWinners.Fields.Item("Accumulative").Value
End If