J
Jason
I have a command button with the code below. The problem I have is that when
I first open the form, the me.recordset.recordcount = 1 (no matter how many
records I have.) I have tried using the movelast, movefirst to get the
recordcount to accurately reflect the number of records, but then the problem
I have is that the button doesn't work on the first click (but it does on the
second). What really throws me for a loop is that the if statement is
executed and it passes through the movenext command, but it doesn't go to the
next record unless you click twice.
Any help is appreciated.
Private Sub cmdNextRecord_Click()
On Error GoTo Err_cmdNext_Click
MsgBox Me.CurrentRecord & "<" & strCount
If Me.CurrentRecord < Me.Recordset.RecordCount Then
Me.Recordset.MoveNext
' MsgBox 2
Else
DoCmd.OpenForm "frmGrade"
End If
Exit_cmdNext_Click:
Exit Sub
Err_cmdNext_Click:
MsgBox Err.Description
Resume Exit_cmdNext_Click
End Sub
I first open the form, the me.recordset.recordcount = 1 (no matter how many
records I have.) I have tried using the movelast, movefirst to get the
recordcount to accurately reflect the number of records, but then the problem
I have is that the button doesn't work on the first click (but it does on the
second). What really throws me for a loop is that the if statement is
executed and it passes through the movenext command, but it doesn't go to the
next record unless you click twice.
Any help is appreciated.
Private Sub cmdNextRecord_Click()
On Error GoTo Err_cmdNext_Click
MsgBox Me.CurrentRecord & "<" & strCount
If Me.CurrentRecord < Me.Recordset.RecordCount Then
Me.Recordset.MoveNext
' MsgBox 2
Else
DoCmd.OpenForm "frmGrade"
End If
Exit_cmdNext_Click:
Exit Sub
Err_cmdNext_Click:
MsgBox Err.Description
Resume Exit_cmdNext_Click
End Sub