Creating and Running Make Table Queries
Whereas an Append query adds records to an existing
table, a Make Table query creates a new table, which is often a
temporary table used for intermediary processing. You might want to
create a temporary table, for example, to freeze data while you are
running a report. By building temporary tables and running a report
from those tables, you make sure users can’t modify the data underlying
the report during the reporting process. Another common use of a Make
Table query is to supply a subset of fields or records to another user.
Build a Make Table Query
To build a Make Table query, follow these steps:
1. | While
in the query’s Design view, select Make Table from the Query Type group
on the Design tab of the Ribbon. The dialog box shown in Figure 9 appears.
|
2. | Enter the name of the new table and click OK.
|
3. | Move all the fields you want included in the new table to the query grid (see Figure 10). You will often include the result of an expression in the new table.
|
4. | Add to the query the criteria you want.
|
5. | Click Run on the toolbar to run the query. The message shown in Figure 11 appears.
|
6. | Click Yes to finish the process.
|
If you try to run the same Make Table query more
than one time, Access permanently deletes the table with the same name
as the table you’re creating. (See the warning message in Figure 12.)
The SQL for a Make Table query looks like this:
SELECT tblTimeCards.TimeCardID, tblTimeCards.EmployeeID,
tblTimeCards.DateEntered, [DateEntered]+365 AS ArchiveDate
INTO tblOldTimeCards
FROM tblTimeCards
WHERE (((tblTimeCards.TimeCardID) Between 1 And 10));