S
Steve
I put this code into a module to count the number of times a button is
clicked. Access calls this function when the button is clicked. I keep
getting error code 3021 when it runs and it says "Either the BOF or EOF is
true, or the current record has been deleted. Requested operation requires a
current record. The VB editor highlights the part "MyCount = MySet!Count"
when it opens. I copied this code verbatim from the web (except changing the
table/field names). I want this to increase the "count" by one each time the
button is clicked. What am I doing wrong? The table and field names are
correct... I've checked that several times.
Function CheckCount()
Dim MySet As ADODB.Recordset
Dim MyCount As Integer
Set MySet = New ADODB.Recordset
MySet.Open "tblCategoryCount", CurrentProject.Connection, , adLockOptimistic
MyCount = MySet!Count
MySet!Count = MyCount + 1
MySet.Update
End Function
clicked. Access calls this function when the button is clicked. I keep
getting error code 3021 when it runs and it says "Either the BOF or EOF is
true, or the current record has been deleted. Requested operation requires a
current record. The VB editor highlights the part "MyCount = MySet!Count"
when it opens. I copied this code verbatim from the web (except changing the
table/field names). I want this to increase the "count" by one each time the
button is clicked. What am I doing wrong? The table and field names are
correct... I've checked that several times.
Function CheckCount()
Dim MySet As ADODB.Recordset
Dim MyCount As Integer
Set MySet = New ADODB.Recordset
MySet.Open "tblCategoryCount", CurrentProject.Connection, , adLockOptimistic
MyCount = MySet!Count
MySet!Count = MyCount + 1
MySet.Update
End Function