Chapter 14Working with Records

Now that you’ve familiarized yourself with various methods of opening, moving around in, and finding records, and reading the contents of a recordset, let’s look at DAO and ADO techniques for adding, modifying, copying, deleting, and sorting records.

Adding a New Record with DAO

In the Microsoft Access user interface, before you can add a new record to a table you must first open the appropriate table. In code, you simply open the Recordset object by calling the OpenRecordset method. For example, the following statements declare and open the Recordset object based on the Employees table:

Dim tblRst As DAO.RecordsetSet tblRst = db.OpenRecordset("Employees")

Once the Recordset object is open, use the AddNew method ...

Get Access 2007 Programming by Example with VBA, XML, and ASP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.