DAO and ADO Recordset Builder

DAO and ADO Recordset Builder

The Recordset Builder makes it very easy to create code to add, read, update or browse data in your MS Access database using DAO (or ADO):

  1. Select the table to work on
  2. Select the fields you want to access
  3. Select the sort of code you want to use: Add, Update, Read or Browse
  4. OK

DAO recordset Add code (example)

With values selected the following DAO code would be inserted

Dim db As DAO.Database
Set db = CurrentDb
Set rstCategories = db.OpenRecordset("Employees", dbOpenDynaset)
With rstCategories
    .AddNew
    ![LastName] =
    ![FirstName] =
    ![HomePhone] =
    ![ReportsTo] =
    .Update
    .Close
End With
Set rstCategories = Nothing
db.Close
Set db = Nothing

DAO Recordset browse code (example)

DAO and ADO Recordset Builder

With values selected the following DAO code would be inserted

Dim db As DAO.Database
Set db = CurrentDb
Set rstCategories = db.OpenRecordset("Employees", dbOpenDynaset)
With rstCategories
    Do While Not .EOF
        Debug.Print ![EmployeeID], ![LastName], ![FirstName], ![HomePhone]
        .MoveNext
    Loop
    .Close
End With
Set rstCategories = Nothing
db.Close
Set db = Nothing