How to create a Query with MS Access


A Query is a question that is asked of a database control program about the data it contains. We specify what particular fields we are interested in finding out, tell the database where to look for those fields, and specify any conditions under which to search. Queries are primarily built from tables, but access gives you you the ability to construct a Query based on the results of another Query. Search nested Queries may require more Computer memory and resources in order to execute but if constructed with care, can save a lot of time, especially when dealing with very large data bases. For the purpose of this manual, we will keep things simple and stick to small all and simple Queries. Plus the great thing about Queries is is that they are only questions asked about data that is already there. If you get Query research that a completely off the mark, no problem. The data is untouched, so provided there is no design flaw in your database, only the Query needs to be adjusted. To create a Query using the wizard, click the Query Wizard command in the create ribbon.



The wizard launches allowing you to select which type of Query to build. For the purposes of this manual, we will demonstrate a simply Query that will retrieve the product ID, product name and price of every product in the sample database. This type of Query is defined as a select Query, one that is used solely to retrieve information. The next step of the wizard is selecting which fields you want to use in your Query. This step of the wizard should look familiar it's just like selecting fields to use in a form. In the Query combobox, select table products. Highlight ID and click > to move the fields to the selected fields list. Repeat for product name and standard cost. the next page of the wizard gives you the option to apply a few summary calculations to the field like the maximum value, minimum value and the average. However we want to see all products, so leave the detail radio button selected. The final page of the wizard lets you name the Query. A long and meaningful name is recommended. Then click finish to view the results of the Query. As you can see by the diagram, the Query results are shown in in what is essentially data sheet view. The result of a Query is essentially a table complete with its own rows. Though more advanced Query functionality is beyond the scope of this manual, you can actually use the results of a Query to construct a table.



by Sachini Sooriyaarachchi

Photo Source: Internet