Use AddNew and specify the field information
Public Sub addCustomer()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = CurrentProject.Connection
Set rs = New ADODB.Recordset
rs.Open "tblCompany", conn, adOpenDynamic, adLockOptimistic, adCmdTable
With rs
.AddNew
.Fields("CompanyName") = "Diner"
.Fields("Address") = "Road"
.Fields("City") = "New York"
.Update
End With
End Sub
Related examples in the same category