Add records to a table (append query).
Syntax
INSERT INTO target [(field1[, field2[, …]])]
VALUES (value1[, value2[, …])
Multiple-record append:
INSERT INTO target [(field1[, field2[, …]])] [IN externaldatabase]
SELECT [source.]field1[, field2[, …]
FROM tableexpression
Key
target The table or query to append records to.
field1, field2 Names of the fields to append data to, if following
a target argument, or the names of fields to obtain
data from, if following a source argument.
externaldatabase The path to an external database file.
source The table or query to copy records from.
tableexpression The table or tables from which records are inserted.
This argument can be a single table name or a
compound resulting from an INNER JOIN, LEFT JOIN,
or RIGHT JOIN operation or a saved query.
value1, value2 The values to insert into the specific fields of
the new record. Each value is inserted into the
field that corresponds to the value's position in
the list: value1 is inserted into field1 of the new
record, value2 into field2, and so on.
Separate values with a comma, and enclose text fields
in quotation marks (' ').
If a value is not specified for all columns in a table, the default value or Null is inserted for the missing columns.
Example
' In SQL
INSERT INTO Employees (FirstName, LastName, Title)
VALUES ('Danny', 'Glover', 'Actor');
In VBS
Dim dbs As Database
Set dbs = OpenDatabase("Northwind.mdb")
dbs.Execute " INSERT INTO Employees " _
& "(FirstName,LastName, Title) VALUES " _
& "('Danny', 'Glover', 'Actor');"
dbs.Close
“Never was anything great achieved without danger” ~ Niccolo Machiavelli
Related:
Delete - Delete records.
Execute (SQL/VBA) - Execute a procedure or run SQL.
Select - Retrieve data from one or more tables or queries.
Select Into - Make-table query.
Sum (SQL) - Add up the values in a query result set.
Update - Update existing field values in a table.