Adding a New Record to a Recordset : Recordset Add Update Delete « Access « VBA / Excel / Access / Word






Adding a New Record to a Recordset

 
Sub cmdAddADO()
    Dim rst As ADODB.Recordset
        Set rst = New ADODB.Recordset
        With rst
            .ActiveConnection = CurrentProject.Connection
            .CursorType = adOpenKeyset
            .LockType = adLockOptimistic
            .Open "Select * from Employees Where EmployeeID = 0"
            .AddNew
                !FirstName = "newF"
                !LastName = "newL"
                !Region = "new"
            .Update
        End With
End Sub

 








Related examples in the same category

1.Add new a row to recordset
2.Use AddNew and specify the field information
3.Use AddNew method from Recordset and two arrays to add a new row
4.Adding a New Record to a Table
5.Modifying a Record
6.Performing Batch Updates
7.Delete row for a certain criteria
8.Deleting a Record
9.Call update method from Recordset
10.Call delete method in Recordset
11.Check the Recordset affected