Hello,
I've created an unbound form to for experimental purposes. I have navigation buttons to move to first,last,next,previous. I get an error message if I'm at the last record and hit the move next command button. I've been experimenting with EOF and BOF if statements But I keep getting the Error message 3021.
Am I missing something in my code?
Function UnBoundMoveNext(frm As Form) As Integer
Dim ctlName As String
Dim x As Integer
If rstEmployees.EOF = True Then
rstEmployees.MoveNext
'Cycle Through the Recordset Setting the Value of Each Control On Form
For x = 0 To rstEmployees.Fields.Count - 1
ctlName = rstEmployees.Fields(x).Name
frm.Controls(ctlName).Value = rstEmployees.Fields(x).Value
Next x
End If
End Function
I've created an unbound form to for experimental purposes. I have navigation buttons to move to first,last,next,previous. I get an error message if I'm at the last record and hit the move next command button. I've been experimenting with EOF and BOF if statements But I keep getting the Error message 3021.
Am I missing something in my code?
Function UnBoundMoveNext(frm As Form) As Integer
Dim ctlName As String
Dim x As Integer
If rstEmployees.EOF = True Then
rstEmployees.MoveNext
'Cycle Through the Recordset Setting the Value of Each Control On Form
For x = 0 To rstEmployees.Fields.Count - 1
ctlName = rstEmployees.Fields(x).Name
frm.Controls(ctlName).Value = rstEmployees.Fields(x).Value
Next x
End If
End Function