← Back to The Recordset Object
Lesson 3

Editing Data

The Recordset Object · Created 2026-06-01 13:34:28

Add, update, and delete rows directly through the Recordset object.

AddNew / Update Pattern
rs.AddNew
rs('title') = 'New Course'
rs('description') = 'Course description'
rs('instructor_id') = 2
rs.Update

Update Existing Row
rs.Open 'SELECT * FROM courses WHERE id=5', conn
rs('title') = 'Updated Title'
rs.Update

Delete Current Row
rs.Open 'SELECT * FROM courses WHERE id=5', conn
If Not rs.EOF Then rs.Delete

Cancel Changes
rs.AddNew
rs('title') = 'Draft'
rs.CancelUpdate ' discards AddNew

EditMode Property
0 = adEditNone - no pending changes
1 = adEditInProgress - modifying existing row
2 = adEditAdd - in AddNew state

Status Property
rs.Status - current row status (0 = adRecOK)

Important
rs.Update commits to database immediately
Update requires a SELECT that identifies table and PK
Without PK, Update uses all-columns WHERE (fragile)
Delete also requires a known PK column

Live Demo →