Search code examples
ms-accessvbams-access-2010recordset

Is rs.MoveFirst implicit in Access VBA?


I have some code that loops through the columns of a recordset, rs. The code seems to work identically if I include rs.MoveFirst or not.

Is .MoveFirst implicitly included if you don't explicitly include it, or is there a subtle difference I'm missing?


Solution

  • From MSDN:

    When you open a Recordset, the first record is current and the BOF property is False. If the Recordset contains no records, the BOF property is True, and there is no current record.

    If the first or last record is already current when you use MoveFirst or MoveLast, the current record doesn't change.

    Based on this, you can see that MoveFirst would be redundant in the scenario where you have non-zero number of records in your RecordSet.