Default Navigate DAO Recordset using Excel userform

  • I am wroking on Access Database(.mdb) using DAO recordset, However i am unable to navigate recordset. like Next, Previous, First, Last recordset. I am unable to find issue with my coding. Below is the code for Move Next

  • Re: Default Navigate DAO Recordset using Excel userform

    Why do you declare a SQL Select string but just open a TableDef?

    1. strSQL = "SELECT * FROM mydb"
    2. Set rs = db.OpenRecordset("mydb")

    Why do you, on the first loop, immediately move to the 2nd record?

    1. If Not rs.EOF Then
    2. rs.MoveNext

    And why do you use a 'With...' Statement then ignore it?

    1. With rs
    2. UserForm1.TXTECN.Value = rs.Fields(ECNNO) & vbNullString

    In the context of the code you posted, the 'Else...' is pointless

    1. Else
    2. rs.MoveFirst

    And the last question. Why would you loop through a recordset assigning the field values to textboxes for each record? That'll just overwrite the previous value on every iteration leaving just the last record displayed.