|
A query is a request you present to the database, and the database displays its response to you. The whole purpose of creating a query lies on how you formulate that request. There are three main ways you create a query in Microsoft Access:
- The Query Wizard offers the simplest approach where in a step by step process you define the purpose of the query and the database will display its answer
- The best way to build a query is by using the Design View
- Once you get familiar with queries, you will find out that a query is just a group of words called a statement you formulate. This means you can write that statement manually. This approach is the most complex because you need to know the structure of a query statement, but it provides more control than the other two techniques.
The simplest way to create a query is by using the Query Wizard. The wizard presents the tables that are part of the database and you select which fields you need.
Such a query is called a Select Query.
Data used on a query can originate from a table, another query, or a combination of tables and/or queries. The first page of the Simple Query Wizard expects you to choose the origin of the query, starting with the table or the query name. For example, you can use a table of employees, then, you choose the necessary data that you want to filter for your query. You can use this query to retrieve the employees' data by their employee number, their last name, the date they were hired, their salary, their marital status, their E-Mail address, or the city or state they live in.
To use the Query Wizard, on the Database Window, you can click the Queries button and then double-click Create Query By Using Wizard. Alternatively, you can first display the New Query dialog from where you would choose Simple Query Wizard. To display the New Query dialog box:
- On the toolbar of the Database window, while in the Queries section, you can click the New button
- On the main menu, you can click Insert -> Query
- On the Database Toolbar, you can click the arrow of the New Object button and click Query
When building a query in the first page of the Simple Query Wizard , you must first specify the object (a table or another query) that will provide data. Then select items using the same types of buttons we reviewed for the Table Wizard.
|
Practical Learning: Creating a Query Using The Wizard
|
|
- The Rockville Techno database should still be opened
On the Database Window, click the Queries button
- To create a query, from the Database window, double-click the Create Query By Using Wizard button
(If you are using MS Access 97, click New, click Simple Query Wizard, and click OK)
- From the Tables/Queries combo box, select Table: CompanyAssets
- From the Available Fields list box, double-click AssetType, Make,
Model, DateAcquired, and PurchasePrice

- Click Next twice
- Give the title AssetsInventrory and make sure the Open The Query To View Information radio button is selected

- Click Finish
|
|