Select … Into

Make-table query.

Syntax
      SELECT field1[, field2[, …]] INTO newtable [IN externaldatabase]
         FROM source

Key
   field1, field2   The fields to be copied into the new table.

   newtable         The name of the table to be created.

   externaldatabase The path to an external database.

   source           The name of the existing table(s) or query from which
                    the records are selected.

Use make-table queries to archive records or make backup copies of tables.

Dim dbs As Database

Set dbs = OpenDatabase("Northwind.mdb")

' Copy the Employees table to a new table, Emp_Backup.
dbs.Execute "SELECT Employees.* INTO Emp_Backup FROM Employees;"

dbs.Close

“Be yourself always, express yourself, and have faith in yourself. Do not go out and look for a successful personality and duplicate him” ~ Bruce Lee

Related:

Delete - Delete records.
DCount - Count the number of records in a table/query.
Execute(SQL/VBA) - Execute a procedure or run SQL.
Insert - Add records to a table (append query).
Select - Retrieve data from one or more tables or queries.
Union - Combine the results of two SQL queries.
Update - Update existing field values in a table.


© Copyright SS64.com 1999-2013
Some rights reserved