MS Access Queries
Although many people use Microsoft Access to create and manage relatively small databases, this software is more powerful than one might think at first sight. It is a relatively easy to use software that allows users to create and manage quite complex databases, as well as offering a series of powerful administration tools.
When using
Queries in Microsoft Access, the programs selects records from one or more tables from a given database so these records can be viewed analyzed or sorted on one single datasheet. Using this function Microsoft Access creates
dynaset, or a collection of records, which will be saved as a database object for future use. The good thing is that this
dynaset (which stands for dynamic subset) is updated automatically when you save and update the original tables, easing greatly your working experience with Microsoft Access. There are several types of queries in Access:
select queries (they will get the data from multiple tables based on values specified by the user),
find duplicates (these queries will display records that contain duplicated values for a specified field) and
find unmatched (this query type shows all the records from one table that do not have any corresponding value in another table). You can create a query in Microsoft Access in
Design View. Go to the
Queries page that you will find on the
Database Window and click the New button. From the list found in the dialog box select
Design View and next click
OK. Now you have to select tables and other queries from the
Tables and
Queries tabs displayed by the program. Next click
Add to add each one to the new query. After you have selected all the desired tables and queries, click the
Close button. By double clicking the field name in the table boxes (or by selecting the field from the
Field: and
Table: menus in the query form) add the fields from the tables to the new created query. In the
Query dialog window, you will see a tab called Criteria. In this field, enter the desired
criteria for the new query.
You should know that Microsoft Access allows the use of query wildcards and arithmetic operators (for example, you can write this <
100 wildcard for values under 100, the like
“c*” to find all the words in the fields that start with the letter c). If you are new to Microsoft Access, you can use the
Query Wizard to have specialized assistance when creating the desired query. You will find the
Create query by using wizard icon in the database window and you can click on it to start the program’s included wizard. Select the fields that will be included in the query from the first dialog window that appears when staring the wizard. You can also select the table to search in from the menu entitled
Tables//Queries. You can select the desired fields by clicking the “>” button. If you want to include all the fields in the query, then click the “>>” button in the wizard’s dialog window. After you have selected all the desired fields, click the
Next button. All you have to do now is to name the newly created query and click
Finish.
You can also use the
Query function to filter out records that have duplicated values. First you will have to create a new query so you can find these duplicated values (create a new
Find Duplicates Query Wizards query by clicking the
New button and selecting that option from the list). Next, you will have to select the tables in which this Query function will find the duplicated entries. Use the list of tables and queries in the dialog window and then click
Next. By clicking the “>” button you can select and move the fields that may contain duplicate values. The nest step is to select the fields that should appear in the new query along with the fields selected earlier.