SELECT...INTO Statement Example (DAO)

Microsoft Jet SQL Reference

SELECT...INTO Statement Example

This example selects all records in the Employees table and copies them into a new table named Emp Backup.

Sub SelectIntoX()

    Dim dbs As Database

    Dim qdf As QueryDef

    ' Modify this line to include the path to Northwind

    ' on your computer.

    Set dbs = OpenDatabase("Northwind.mdb")

    ' Select all records in the Employees table

    ' and copy them into a new table, Emp Backup.

    dbs.Execute "SELECT Employees.* INTO " _

        & "[Emp Backup] FROM Employees;"

        

    ' Delete the table because this is a demonstration.

    dbs.Execute "DROP TABLE [Emp Backup];"

    

    dbs.Close

End Sub