DS said:
Hoe do you you select from one table (Table1) certain records and INSERT
into (Table2) using SQL.
Thanks
DS
Hi DS !
In our example, destination Table2 has 3 Fields: Name, Address, Fone
and our source Table1 has several fields, but 3 on our focus: CustomerName,
CustomerAddress and CustomerFone.
The names must match with the destination table - thus...
Criteria = "INSERT INTO Table2 " _
& "SELECT CustomerName AS Name, CustomerAddress AS Address, CustomerFone
AS Fone " _
& "FROM Table1 " _
& "WHERE " & Condition & " " _
& "ORDER BY CustomerName;"
DoCmd.RunSQL Criteria ' Execute the SQL comand
That is faster than any procedure with recordsets, in VBA.
Good luck...