L
Laurel
Can anyone think of what might cause this subroutine to fail at the first
statement after the ELSE with "no current record?" The situation is that 3
rows have been retrieved into the form. The focus arrow is on the first
row. The first time the subroutine is triggered, it works fine, but if it
is triggered again on that same first row, it hits the NO CURRENT RECORD
error. I never get the error if the focus is on row 2 or 3, but I suspect
that is because action has to be taken to make them current i.e., the user
must click on them, because after the subroutine below is executed, focus is
set back to the first record. If the user clicks on one of the other
records and then back on the first record, the subroutine works fine. In
other words, the error seems to occur if the user hasn't explicitly clicked
on the row before it is triggered unless it triggered immediately after the
rows are retrieved.
Private Sub cmdMassUpdate_Click()
Dim lngRecCount As Long
Dim lrstMe As Recordset
If IsNull(txtPeriod) Then
MsgBox ("There is no row in tblPeriods for period " & cboPeriod_Code
_
& vbCrLf & "Mass Update will not be performed.")
Exit Sub
End If
is_Debug = Me!Student_ID
DoCmd.RunCommand acCmdSaveRecord 'Make sure newly added row is
recognized
is_Debug = Me!Student_ID
Set lrstMe = Me.Recordset
If lrstMe.RecordCount = 0 Then
MsgBox ("There are no rows." _
& vbCrLf & "The scores will not be copied.")
Exit Sub
'Empty Recordset
Else
is_Debug = lrstMe!Student_ID THIS IS WHERE THE NO CURRENT RECORD
ERROR OCCURS
lrstMe.MoveLast
is_Debug = lrstMe!Student_ID
lrstMe.MoveFirst
is_Debug = lrstMe!Student_ID
statement after the ELSE with "no current record?" The situation is that 3
rows have been retrieved into the form. The focus arrow is on the first
row. The first time the subroutine is triggered, it works fine, but if it
is triggered again on that same first row, it hits the NO CURRENT RECORD
error. I never get the error if the focus is on row 2 or 3, but I suspect
that is because action has to be taken to make them current i.e., the user
must click on them, because after the subroutine below is executed, focus is
set back to the first record. If the user clicks on one of the other
records and then back on the first record, the subroutine works fine. In
other words, the error seems to occur if the user hasn't explicitly clicked
on the row before it is triggered unless it triggered immediately after the
rows are retrieved.
Private Sub cmdMassUpdate_Click()
Dim lngRecCount As Long
Dim lrstMe As Recordset
If IsNull(txtPeriod) Then
MsgBox ("There is no row in tblPeriods for period " & cboPeriod_Code
_
& vbCrLf & "Mass Update will not be performed.")
Exit Sub
End If
is_Debug = Me!Student_ID
DoCmd.RunCommand acCmdSaveRecord 'Make sure newly added row is
recognized
is_Debug = Me!Student_ID
Set lrstMe = Me.Recordset
If lrstMe.RecordCount = 0 Then
MsgBox ("There are no rows." _
& vbCrLf & "The scores will not be copied.")
Exit Sub
'Empty Recordset
Else
is_Debug = lrstMe!Student_ID THIS IS WHERE THE NO CURRENT RECORD
ERROR OCCURS
lrstMe.MoveLast
is_Debug = lrstMe!Student_ID
lrstMe.MoveFirst
is_Debug = lrstMe!Student_ID