0

The following code coincides with an onClick event on my form to move to the next record in a file, but I keep getting the Error Code: 424, object required. I have (3) other buttons on my form: MoveFirst, MoveLast and MovePrevious, but they all work fine.

What is different with this button that an "object is required"? Can anyone lend some assistance?

Thanks in advance.

Private Sub cmdMoveNext_Click()
     On Error GoTo DbError
    
    'Move to the next record in the result set if the cursor is not
    'already at the last record.
    If rsEmployees.AbsolutePosition < rsEmployees.RecordCount Then
              
        rs.Employees.MoveNext
        Me.txtID = rsEmployees!ID
        Me.txtCompany = rsEmployees.Fields.Item("Company")
        Me.txtFName = rsEmployees.Fields.Item("First Name")
        Me.txtLName = rsEmployees.Fields.Item("Last Name")
        Me.txtEmail = rsEmployees.Fields.Item("E-mail Address")
        
    End If
    Exit Sub
DbError:
    MsgBox "There was an error retrieving information " & _
        "from the database." _
        & Err.Number & ", " & Err.Description
        
End Sub
1
Contributor
1
Reply
3
Views
9 Years
Discussion Span
Last Post by clueless101
0

As soon as I reviewed this posting, I realized there was an extra "." that did not belong.

rs.Employees.MoveNext

it should be: rsEmployees.MoveNext

Thanks anyway!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.