O'Reilly logo

Access 2007 Programming by Example with VBA, XML, and ASP by Julitta Korol

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required