Create a table query Access 2007

Author: mety Labels::



Understand make table queries

A make table query retrieves data from one or more tables, and then loads the result set into a new table. That new table can reside in the database that you have open, or you can create it in another database.
Typically, you create make table queries when you need to copy or archive data. For example, suppose you have a table (or tables) of past sales data, and you use that data in reports. The sales figures cannot change because the transactions are at least one day old, and constantly running a query to retrieve the data can take time — especially if you run a complex query against a large data store. Loading the data into a separate table and using that table as a data source can reduce workload and provide a convenient data archive. As you proceed, remember that the data in your new table is strictly a snapshot; it has no relationship or connection to its source table or tables.
The process of creating a make table query follows these broad steps:
  • Enable the database, if it is not signed or if it does not reside in a trusted location. You cannot run action queries (append, update, and make table queries) otherwise.
  • In query Design view, create a select query and then modify that query until it returns the records you want. You can select data from more than one table and, in a real sense, you can de-normalize your data. For example, you can place customer, shipper, and supplier data in a single table, something you would not do in a production database with properly normalized tables. You can also use criteria in the query to further customize or narrow your result set.
  • Convert the select query to a make table query, choose a location for the new table, and then run the query to create the table.
Do not confuse a make table query with an update or append query. You use an update query when you need to add or change data in individual fields. You use an append query when you need to add records (rows) to an existing set of records in an existing table.


Create a make table query

You create a make table query by first creating a select query, and then converting it to a make table query. Your select query can use calculated fields and expressions to help return the data that you need. The following steps explain how to create and convert the query. If you already have a select query that fits your needs, you can skip ahead to the steps for converting the select query and running the make table query.

Enable the database

Note Follow these steps only when your database does not reside in a trusted location or is not signed. Access displays the Message Bar whenever you open an untrusted or unsigned database.
  1. On the Message Bar, click Options.
  2. In the Microsoft Office Security Options dialog box, click Enable this content, and then click OK.

If you don't see the Message Bar

  • On the Database Tools tab, in the Show/Hide group, click Message Bar.

Create the select query

Note If you already have a select query that produces the data that you need, go to the next steps.
  1. On the Create tab, in the Other group, click Query Design. Access Ribbon Image
  2. In the Show Table dialog box, double-click the tables from which you want to retrieve data. Each table appears as a window in the upper section of the query designer. Click Close when have finished adding the tables.
  3. In each table, double-click the field or fields that you want to use in your query. Each field appears in a blank cell in the Field row of the design grid. This figure shows the design grid with several table fields added.
  4. A query with three fields in the design grid
  5. Optionally, add any expressions to the Field row.
  6. Optionally, add any criteria to the Criteria row of the design grid.
  7. Click Run Button image to run the query and display the results in a datasheet.
  8. Optionally, change your fields, expressions, or criteria and rerun the query until it returns the data that you want to place in your new table.

Convert the select query

  1. Open your select query in Design view, or switch to Design view. Access provides several ways to do this:
    • If you have the query open in a datasheet, right-click the document tab for your query and click Design View.
    • If the query is closed, in the Navigation Pane, right-click the query and click Design View on the shortcut menu.
  2. On the Design tab, in the Query Type group, click Make Table. The Make Table dialog box appears.
  3. In the Table Name box, enter a name for the new table. -or-
    Click the down-arrow and select an existing table name.
  4. Do one of the following:
    • Place the new table in the current database
      1. If it isn't already selected, click Current Database, and then click OK.
      2. Click Run Button image, and then click Yes to confirm the operation. Note If you are replacing an existing table, Access first deletes that table and asks you to confirm the deletion. Click Yes, and then click Yes again to create the new table.
    • Place the new table in another database
      1. Click Another Database.
      2. In the File Name box, enter the location and file name of the other database. -or-
        Click Browse, use the new Make Table dialog box to locate the other database, and click OK.
      3. Click OK to close the first Make Table dialog box.
      4. Click Run Button image, and then click Yes to confirm the operation. Note If you replace an existing table, Access first deletes that table and asks you to confirm the deletion. Click Yes, and then click Yes again to create the new table.

Learn more about query criteria and expressions

The steps in this article mentioned query criteria and expressions. A query criterion is a rule that identifies the records that you want to include in a query, and you use criteria when you do not want to see all the records in a given set of data. For example, the criterion >25 AND <50 returns values greater than 25 and less than 50. A criterion such as "Chicago" OR "Paris" OR "Moscow" returns only the records for those cities.

An expression is a combination of mathematical or logical operators, constants, functions, and names of fields, controls, and properties that evaluates to a single value. You use an expression when you need data that does not reside directly in a table. For example, the expression [UnitPrice]*[Quantity] multiplies the value in the UnitPrice field by the value in the Quantity field. You can use expressions in a wide variety of ways, and the process of creating and using them can become quite complex.

Stop Disabled mode from blocking a query

By default, if you open a database that does not reside in a trusted location, or if you have not chosen to trust the database, Access prevents all action queries — append, update, delete, or make-table queries — from running.
If you try to run an action query and it seems like nothing happens, check the Access status bar for the following message:
This action or event has been blocked by Disabled Mode.
When you see that message, do the following:

Enable blocked content

  • On the Message Bar, click Options. The Microsoft Office Security Options dialog box appears.
  • Click Enable this content, and then click OK.
  • Run your query again.

If you don't see the Message Bar

  • Click the Database Tools tab, and in the Show/Hide group, click Message Bar.


0 comments |

Labels

Blog Archive

Powered by Blogger.

I made these pages for me and my friends to help solving the problem we face regarding Computer & internet, if anyone wants me to answer a question or find out about some information please send me email and I will try to reply.*P.S. some of the article I wrote and the other I found on the internet I posted them in sprit of learning and shearing, please forgive me if you found something you don’t want to be in my blog, email me and I will delete them. Thank you for your interest in my pages.امل نجم Amal Nagm

banner 1 banner 2