Access Tip of the Day


Copy a table's structure using a make-table query (Access 97/2000/2002)


Although you might typically use make-table queries to copy existing subsets of data to a new table, you can also use them to create new blank tables based on an existing table structure. Although it's easy to manually copy an existing table structure, a make-table query provides an easy way to streamline the process if you perform the task on a repetitive basis or you need to provide a solution for someone who isn't as familiar with Access as you are.

To create a query that copies an existing table structure, but ignores all of the data, do the following:

1. Create a new query in Design view and add the table that has the structure you want copied, closing the Add Table dialog box afterward.

2. From the menu bar, choose Query | Make-Table Query

3. Specify a name for the new table in the Table Name text box and click OK.

4. Drag the asterisk from the table's field list down to the design grid.

5. In the next column of the design grid, enter the following in the Field text box:

Expr1: False

6. In that column's Criteria text box, enter:

<>False

7. Clear the Show check box in the Expr1 column.

Since the criteria condition can never be met, running this query produces a blank copy of the table upon which the query is based. Note that the query doesn't copy the original table's primary key, indexes, or field and table properties. All properties are reset to default settings.



(Content provided by Element K Journals)


(Note: Your browser is set to refuse cookies. As a result, you may frequently see previously-viewed tips)
 
PrintPrint CloseClose

Copyright © 2001 - 2021 MJ Technologies, LLC.  All rights reserved.