Introduction to Queries

Help Center Microsoft Access Introduction to Queries

Queries select records from one or more tables in the same database so that they can be manipulated on the same datasheet. The resulting datasheet, called a dynaset, short for dynamic subset, is saved as an object and can be used again in the future. Queries are automatically updated whenever the original tables are modified. There are three types of queries:

  • Select Queries extract data from tables based on values specified in the Criteria box.
  • Find Duplicate Queries display records with duplicate values in one or more of the fields specified. Find Unmatched Queries display records from one table that do not a corresponding value in a second table.

Query Wizard

The Query Wizard will lead you step by step through creating your query.

queryWizard
  1. Click the Create query by using wizard icon in the database window.
  2. In the first window, select fields to be included in the query by selecting the table you wish to search from the drop-down Tables/Queries menu. Click the > button to move the field you are going to query from the Available Fields list to Selected Fields. Click the >> button to move all of the fields to Selected Fields. Click Next > when all of the fields have been selected.
  3. In the next window, enter the name for the query and click Finish.

To add Criteria to your query, switch to Design View. Click on the Criteria field and enter a query expression. The Expression Builder can also be used to help you write expressions. After you are finished adding criteria, click the Run button on the toolbar.

    Common Expression Operators
  • ? - takes the place of a single character and allows you to search for expressions where a character can vary
  • * - takes the place of multiple characters
  • < - less than a specified value
  • > - greater than a specified value
  • >= - greater than or equal to a specified value
  • <> - not equal to
  • Between # and # - replace the # with two numbers to search within that range of numbers
  • Is null - finds all records with no value
  • Is not null - finds all records with a value
  • Like "a*" - Finds all words beginning with the letter a
  • And - use to search with more than one criteria at the same time
  • Or - search for one value or another