Xuân Thanh > 08-12-12, 10:04 AM
Public Sub AddNew()
Dim DB As Database
Dim rs As Recordset
Set DB = CurrentDB
Set rs = DB.OpenRecordset("tblCompany", dbOpenTable)
With rs
.AddNew
!CompanyName = "A"
!Address = "B"
!City = "C"
.Update
End With
rs.Close: Set DB = Nothing
End Sub
Public Sub AddNewArray()
Dim DB As Database
Dim rs As Recordset
Set DB = CurrentDB
Set rs = DB.OpenRecordset("tblCompany", dbOpenTable)
varfields = Array("CompanyName", "Address", "City")
varValues = Array("A", "B", "C")
rs.AddNew varfields, varValues
rs.Update
rs.Close: Set DB = Nothing
End Sub