DAO and ADO Recordset Builder

DAO and ADO Recordset Builder

The Recordset Builder makes it very easy to create code to add, read or update 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. Press OK

DAO recordset Add code (example)

With values selected the following DAO code would be inserted

Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("Employees", dbOpenDynaset)
With rst
    .AddNew
    ![Business Phone] =
    ![Company] =
    ![E-mail Address] =
    ![First Name] =
    ![Job Title] =
    ![Last Name] =
    .Update
    .Close
End With
Set rst = Nothing
db.Close
Set db = Nothing

ADO recordset Add code (example)

With values selected the following DAO code would be inserted

Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "Employees", CurrentProject.Connection, adOpenDynamic, adLockOptimistic, adCmdTable
With rst
    .AddNew
        ![Business Phone] =
        ![Company] =
        ![E-mail Address] =
        ![First Name] =
        ![Job Title] =
        ![Last Name] =
        ![Logveld] =
    .Update
    .Close
End With
Set rst = Nothing