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

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.