I have the following code in a database but get an 3027 error when I run it.
Everything else works except the bit I underlined
I am trying to write strPreviousScore to the Score field for the current recordset
Being a novice I am stuck on this problem and any help will be appreciated and restore my sanity
EDIT: I changed the code to Set rst = dbs.OpenRecordset(strSQL) and now get a 3020 Error
Now I am more confused, I figured that the 'type' setting was wrong but do not know which option to choose and rst!Score= strPreviousScore bit still does not work
cheers
Wayne
CODE:
Sub subInsertScores(strSQL As String, strMaxScore As String)
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset(strSQL, dbOpenSnapshot, dbSeeChanges)
'**Find the number of records.
rst.MoveLast ' End of the recordset
strRecordCount = rst.RecordCount ' Number of records
strPreviousScore = 0
strPreviousTime = 0
'loop through each record and add score
rst.MoveFirst
For A = 0 To (strRecordCount - 1)
strCurrentPoints = rst![Total Points]
strCurrentTime = rst![TotalTime]
strCurrentScore = rst![Score]
If strCurrentPoints = strPreviousPoints Then rst![Score] = strPreviousScore
'**set currents to previous here before moving to next record
strPreviousPoints = rst![Total Points]
strPreviousScore = rst![Score]
strPreviousTime = rst![TotalTime]
rst.MoveNext
Next
End Sub