Home  Fees/Services  Access Templates  Tutorials  Access Download  Articles  Search  Contact  Privacy  Links

Access Query Examples
MS Access SQL Support & Training
SQL Insert Into Query
Access Append Query Example

SQL Insert Into SQL Tutorial Queries Microsoft Access 2007 Query Help
Professional Microsoft Access Programmers

Access Template Databases:


MS Query Tutorials:

Aggregate Functions
Choose Function
More Choose Functions
Crosstab Query Tutorial
Crosstab Query Advanced
DateTime Query
Delete Query Tutorial
External Link Query
Access Report Filter Query
Group By Clause
Access Having Clause
Histogram Query Tutorial
Insert Into Query
Master/Detail Updates
Order By Dynamic
Access Parameter Query
Predicate Query Example
Self Join Query Tutorial
Scalar Query Example
Child/Parent Table Query
Select Statement Tutorial
Select Top 1 Query
Union Query Example
Access Update Query

Multi-Select Parameter Forms Query Tutorial


Insert Into Query

The insert into SQL statement is the DML (data manipulation language) command to use to append new records to a table in your relational database.

The basic syntax of the Insert Into SQL query for a single record is:

Insert Into TableName (FieldName1, FieldName2) Values (Value1, Value2);

For multiple records gathered from other tables or external sources the Access insert into SQL query is slighty different:

Insert Into TableName (FieldName1, FieldName2) Select FieldName1, FieldName2 From TableName;

The full syntax of the Access insert into SQL query statement from Microsoft Access help is:

INSERT INTO target [IN externaldatabase] [(field1[, field2[, ...]])] SELECT [source.]field1[, field2[, ...] FROM tableexpression;

Where:

Insert Into Query Append

Note: The ending semicolon is a required component of all SQL statements.

Now the insert into query with real column and table names for a single row:

Insert Into M_Employees (Emp_ID, Emp_Name, Emp_Start_Date) Values (00212, "Joseph Dean", #01/02/06#);

Note that text values are bounded by quote marks and date values are bounded by pound signs in the insert into query.

Multiple row inserts using the select statement alternative - a variation of the insert into query.

Insert Into M_Employees (Emp_ID, Emp_Name) Select Emp_ID, Emp_Name From MyLinkedSpreadsheet Where Emp_Status="New";

Note that we restrict the number of records to only those records with a status value of 'New".

More Append Query Examples:

Docmd RunSQL Access Append Query

SQLText = "INSERT INTO T_Orders ( Order_Numb, ITEMDESC, XTNDPRCE, QUANTITY ) SELECT SOPNUMBE, ITEMDESC, XTNDPRCE, QUANTITY " & _ ...
www.blueclaw-db.com/docmd_runsql_example.htm
 

Concatenate Records Insert Query

RunSQL ("INSERT INTO T_Patient_alrgy ( Patient_ID, Allergy ) " & _ " SELECT " & Patient_ID & ",'" & hold_alrgy & "'") End Function ...
www.blueclaw-db.com/concatenate_multiple_records_one_field.htm


Contact Information

Microsoft Access Developer

Microsoft Access Query 2007 2003 2000 Access Query Tutorial