Microsoft Access Tutorial: How to Query an Access Table

Kantus
To query Access tables, you can use the built-in wizard or you can write your own SQL query for Access. In this reading I will use the built-in wizard for querying an Access database table. The wizard in Access will automatically generate the SQL needed for the desired results. You will see how to see this SQL and how to execute just the SQL against the Access table.

I will be using an Access database that has a table called "People" with four fields (FirstName, LastName, Age, and State). There are 3 rows in the Access table. If you don't have a table to use for this tutorial, refer to my previous Microsoft Access Tutorials to learn how to create a table in Access and how to insert data into the table.

1. Open the Microsoft Access database

For this example, the database is called MyFirstAccessDB.

2. Click on Queries

To make a query against the Access table that exists (table is called People), click on the "Queries" that is shown on the left pane of the main Access dialog box.

3. Double-Click "Create query by using wizard"

4. Select the Fields

A new window called "Simple Query Wizard" will open up asking you for the Table you want to query and the fields you want to display in the query of the Access table. Under Tables/Queries, select the table (People). Under Available Fields, select all 4 fields by clicking on it and then the ">" button, or click on the ">>" button to bring all the fields to the "Selected Fields" list, and then click "Next".

5. Select "Detail" and click Next.

6. Name the Query

Give the query some name by writing into the textbox. Check the "Open the query to view information" and click Finish.

This will bring up the results from the query of the Access table you just created. This will also create a new query with the name you gave it and show it on the right pane of the main Access window from Step 2 above.

Now to see the SQL behind the query in Access, click on View -> SQL View. This will change it to the SQL that was executed to show you the results you were seeing. For my case, it says "SELECT People.FirstName, People.LastName, People.Age, People.State FROM People;" That is the actual SQL query that is executed by Microsoft Access when you see the results you saw previously after step 6 from above!

Published by Kantus

I love writing short stories and humor articles, but tend to stick with topics that are discoverable by search engines and capable of spreading virally.  View profile

To comment, please sign in to your Yahoo! account, or sign up for a new account.