With DAO, you have the automatically generated key after the AddNew, but if
you don't capture it, be aware that after the Update, the recordset will
likely be focused at the record you were before the AddNew.
With ADO, you can read the key after the AddNew since the record with the
focus will be the one you just added.
The following code illustrates the behavior about which record is the
current record after you append a new record:
===================
Public Sub ADODAO()
Dim rst As DAO.Recordset
Dim uvw As New ADODB.Recordset
Set rst = CurrentDb.OpenRecordset("Table1")
uvw.Open "Table1", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic, adCmdTable
uvw.MoveLast
uvw.MovePrevious
Debug.Print "ADO, we start with: " & uvw.Fields("f1").Value
uvw.AddNew
uvw.Fields("f1") = "new field"
uvw.Update
Debug.Print "ADO, after the Update, we are at: " &
uvw.Fields("f1").Value
rst.MoveLast
rst.MovePrevious
Debug.Print "DAO, we start with: " & rst.Fields("f1").Value
rst.AddNew
rst.Fields("f1") = "DAO's one"
rst.Update
Debug.Print "DAO, after the Update, we are at: " &
rst.Fields("f1").Value
End Sub
=====================
and, in my case, I got:
-------------------Immediate Window
ADODAO
ADO, we start with: ab
ADO, after the Update, we are at: new field
DAO, we start with: a
DAO, after the Update, we are at: a