Use a screen reader to create a query in Access desktop databases

You can use a screen reader and keyboard to create a query in Access. A query makes it easier to view, add, delete, or change data in your Access desktop database. Queries are also useful when you want to find specific data quickly, calculate or summarize data, or automate data management tasks, such as reviewing the most current data on a recurring basis.

Note: This topic assumes that JAWS users have the Virtual Ribbon Menu feature turned off.

In this topic

Types of queries

In a well-designed database, the data that you want to present through a form or report is usually located in multiple tables. A query pulls the information from various tables and assembles it for display in a form or report. There are two major types of queries, a select query and an action query. The type of query you create depends on the task you want to perform.

A select query is a request for data results. A select query helps you get just the data you need in a Datasheet view. Use a select query to:

  • Review data from only certain fields in a table

  • Review data from several related tables simultaneously

  • Review data based on certain criteria

  • Make calculations

  • Combine data from different tables.

For example, if a Product table has multiple fields (columns), you can create a select query to get an uncluttered view that focuses on just the fields (columns) you need. You can also add criteria to filter the number of rows returned, so that, for example, only rows containing products costing more than $10.00 are returned.

An action query is a request for action on the data. Use an action query to add, change, or delete data from your database. Each task, such as adding or deleting data, has a specific type of action query.

Create a select query

You can create a select query by using the Query Wizard or the Query Designer. If you want to perform a simple query, use the Query Wizard. If you want to add criteria to your query, use the Query Designer.

Use the Query Wizard

  1. Press Alt+C, Q+Z. The New Query window opens, with the Simple query wizard selected.

    Tips: 

    • If you haven’t yet saved the table you want to create a query for, you will be prompted to do so before the Query Wizard opens.

    • You can also use the Query Wizard to create other types of queries: Crosstab Query, Find Duplicates Query (to find records with duplicate field values in a single table), and Find Unmatched Query (to find records [rows] in one table that have no related records in another table).

  2. Press Enter. The Simple Query window opens, with the focus on the Available fields list box.

  3. To move to the Tables/Queries edit combo box, press Alt+T or Shift+Tab.

  4. To open a drop-down list, press Alt+Down Arrow. On the drop-down list, to select the table you want to run the query on, use the Up Arrow key and the Down Arrow key.

  5. To move to the Available fields list box, press the Tab key. To select the field you want to run the query on, use the Down Arrow key.

  6. To add the field to your query, press Alt+S. The focus moves to the Selected fields list box.

  7. Press the Tab key. When you hear “Greater than button,” press Enter. If you want to add all the fields, press Alt+S, tab until you hear “Double Right Arrow button,” and then press Enter.

    To add more tables to your query, press Alt+T. The focus moves to the Tables/Queries edit field. Repeat steps 4–7 as needed.

  8. When you have finished entering all your tables and fields, to move to the next wizard page, press Alt+N.

    Tip: Depending on the information you entered, the next wizard pages may vary. For example, you may be asked to select a detail or summary version of your query. Make your selection and, to move to the next wizard page, press Alt+N.

  9. When you move to a new wizard page and you hear “What title do you want for your query?” press Shift+Tab. The focus moves to the Title edit field. Type a name.

  10. View, modify, and save your query.

    • To save the query and open it to view the information, press Alt+O, Enter. To close the query, press F6.

    • To save the query and exit the wizard without viewing the query results, press Alt+F. When the wizard closes, the query appears on a new tab, with the focus in the first cell

    • To modify the design of the query, press Alt+M, Enter. The query opens in Design view.

Use the Query Designer

  1. Press Alt+C, Q+D. The Show Table dialog box opens with the Tables tab selected, and you hear “Show table dialog.”

  2. In the Show Table box, to select a table and add it to the query, use the Down Arrow key, and then press Alt+A. The table is pasted in the workspace, above the design grid.

  3. To close the Show Table dialog box, press Alt+C.

  4. The focus is in the design grid, in the Field row edit box. You hear “Design, Autonumber, type and text.” (In Narrator, you hear “Access, Row 1, Column 1.”) To add a field to the design grid, press Alt+Down Arrow. A drop-down list of available fields opens.

  5. To move to the drop-down list, press Ctrl+Up Arrow. (In Narrator, the focus moves automatically to the drop-down list.)

  6. To select a field from the drop-down list, use the Down Arrow key and then press Enter. The field you selected appears in the column. The focus automatically moves to the next column.

  7. To add another field to your query, repeat steps 4–6.

  8. To add a criterion to a field:

    1. In the column of the field you want to add a criterion to, press the Down Arrow key until you hear “Criteria.” (In Narrator, you hear “Row 11, Column 1.”)

    2. Enter a criterion. For example, for a Price field on a Products table, you might enter >=10 to show a list of products greater than or equal to $10.00.

  9. To see the query results, press Alt, J+Q, and then G.

  10. To save your query, press Ctrl+S. In the Save as dialog box, enter a name for your query and press Enter.

Note: You can use Query Designer to simultaneously review data from multiple related tables. For example, if you have a database with a Customers table and an Orders table, and each table has a Customer ID field, which forms the basis of a one-to-many relationship between the two tables, you can create a query that returns orders for customers in a particular city. To create a query that simultaneously reviews data from multiple tables, use the procedure listed here, but repeat steps 2 through 8 to add additional tables, fields, and criteria to the query.

Create a parameter query

If you frequently run variations of a particular query, consider using a parameter query. When you run a parameter query, the query prompts you for field values and then uses the values that you supply to create criteria for your query.

  1. In the Navigation pane, select the query you want to base your parameter query on.

  2. Press the Application key (usually found in the lower-right section of the keyboard) or Shift+F10. A shortcut menu opens and you hear “Open, O.”

  3. Press D. The query opens in Design view, with the focus in the first row of the first field in the query design grid.

  4. To move to the field you want to modify, use the Right Arrow key.

  5. To move to the Criteria row, press the Down Arrow key until you hear “Criteria.” (In Narrator, you hear “Row 11, Column 1.”)

  6. In the cell, delete any existing information and enter a parameter string. For example, if you want to create a parameter query for a query to find customers in New York, delete “New York” and enter [For what city?]. You cannot use a period (.) or an exclamation point (!) as text in a parameter prompt.

    The string [For what city?] is your parameter prompt. The brackets indicate that you want the query to ask for input, and the text (in this case, [For what city?]) is the question that the parameter prompt displays.

  7. To run the query, press Alt, J+Q, and then G. The Enter parameter value window opens, with the focus in the edit field. Enter a value, for example, New York.

  8. Tab to the OK button and press Enter. In this example, orders for customers in New York appear.

Specify parameter data types

You can also specify what type of data a parameter should accept. You can set the data type for any parameter, but it is especially important to set the data type for numeric, currency, or date/time data. When you specify the data type that a parameter should accept, users see a more helpful error message if they enter the wrong type of data, such as text when currency is expected.

Note: If a parameter is set to accept text data, any input is interpreted as text, and no error message is displayed.

To specify the data type for parameters in a query:

  1. Open the parameter query. To switch to Design view, press Alt+H, W, and then D. The design grid opens.

  2. Press Alt, J+Q, and then S+P. The Query Parameters dialog box opens, with the focus in the Parameter column.

  3. Type the prompt for each parameter for which you want to specify the data type. Make sure that each parameter matches the prompt that you use in the Criteria row of the query design grid. For example, if you entered [For what city?], you would enter that same prompt in the Query Parameters dialog box.

  4. To move to the Data Type column, press the Tab key.

  5. To open a drop-down list, press Alt+Down Arrow.

  6. To select the data type for a parameter, use the Down Arrow key.

  7. To save and exit the dialog box, press Enter.

More information about use parameters to ask for input when running a query.

Create a crosstab query

When you want to restructure summary data to make it easier to read and understand, use a crosstab query. A crosstab query calculates a sum, average, or other aggregate function, and then groups the results by two sets of values—one down the side of the datasheet and the other across the top. You can use the Query Wizard to quickly create a crosstab query.

The Crosstab Query Wizard makes you choose a single table or query as the record source for your crosstab query. If a single table does not have all the data you want to include in your crosstab query, start by creating a select query that returns the data you want.

  1. Press Alt+C, Q+Z. The New Query dialog box opens, with the Simple query wizard selected.

    Tip: If you haven’t yet saved the table you want to create a query for, you will be prompted to do so before the Query Wizard opens.

  2. Press the Down Arrow key. You hear “Crosstab Query Wizard.”

  3. Press Enter or Alt+N. The Crosstab Query Wizard opens, with the Tables radio button selected and the focus in the Tables list box.

  4. Select the objects you want to use to create a crosstab query:

    • To select a table, use the Down Arrow key.

    • To select a query, press Alt+Q. When you hear “Queries radio button checked,” to move to the list box, press Shift+Tab, and then, to select a query, use the Down Arrow key.

    • To select both tables and queries, press Alt+O. When you hear “Both radio button checked,” to move to the list box, press Shift+Tab, and then, to select the tables and queries you want, use the Down Arrow key.

  5. To move to the next page, press Enter or Alt+N.

  6. The next page opens with the focus in the Available fields list box. To select the field that contains the values you want to use as row headings, press the Down Arrow key.

  7. To add the selected field, press the Tab key and then press Enter. Repeat this for each field you want to add.

    Tips: 

    • You can select up to three fields to use as row headings sources, but the fewer row headings you use, the easier your crosstab datasheet will be to read.

    • If you choose more than one field to supply row headings, the order in which you choose the fields determines the default order in which your results are sorted.

  8. To move to the next wizard page, press Enter or Alt+N

  9. On the next page, to select the field that contains the values you want to use as column headings, use the Down Arrow key.

    Tip: In general, you should choose a field that contains few values, to help keep your results easy to read. For example, using a field that has only a few possible values (such as gender) might be preferable to using a field that can contain many different values (such as age).

  10. If the field you choose to use for column headings has the Date/Time data type, the wizard adds a step that lets you group the dates into intervals. You can specify Year, Quarter, Month, Date, or Date/Time. If you do not choose a Date/Time field for column headings, the wizard skips this page.

  11. To move to the next page, press Enter or Alt+N. When the page opens, the first field is selected in the Fields list box, and the focus is in the Functions list box.

  12. To move to the Fields list box, to select a different field, press Shift+Tab. You hear “Fields, Colon, List box,” and the name of the first field. (In Narrator, you hear “Fields, Selected.”)

  13. To select a field, use the Down Arrow key.

  14. To move to the Functions list box, press the Tab key. You hear “Functions, Colon, List box,” and the name of the first function. (In Narrator, you hear “Functions, Selected.”)

  15. To select a function to use to calculate summary values, use the Down Arrow key. The data type of the field selected determines which functions are available.

  16. When you have finished making your selection, tab to the Yes, include row sums check box and select or clear it.

    If you include row sums, the crosstab query has an additional row heading that uses the same field and function as the field value. Including a row sum inserts an additional column that summarizes the remaining columns. For example, if your crosstab query calculates average age by location and gender (with gender column headings), the additional column calculates the average age by location, across all genders.

    Tip: You can change the function that is used to produce row sums by editing the crosstab query in Design view.

  17. To move to the next wizard page, press Enter or Alt+N.

  18. On the next page, to name your query, press Shift+Tab and then enter a name. The default name contains the suffix “_crosstab.”

  19. View, modify, and save the query.

    • To view the crosstab query, press Enter.

    • To modify the query design, press Alt+M, Enter.

    • To save the query and exit the wizard, press Alt+F.

Create a delete query

When you want to simultaneously remove entire records (rows) from a table or from two related tables, use a delete query. A delete query is useful because it lets you specify criteria to quickly find and delete the data. It can also save you time, because you can reuse a saved query.

Notes: 

  • Before you delete any data or run a delete query, make sure that you have a backup of your Access desktop database. A delete query gives you an opportunity to review the rows that will be deleted before you perform the deletion.

  • If you want to delete only a few records, you don’t need a query. Just open the table in Datasheet view, select the fields (columns) or records (rows) you want to delete, and then press Delete. You will be asked to confirm the permanent deletion.

Create a delete query

  1. Press Alt+C, Q+D. The Show Table dialog box opens.

  2. To select a table, use the Down Arrow key. Press Alt+A. Repeat this for each table you want to delete records from.

  3. To close the Show Table dialog box, press Alt+C. The table appears as a window in the upper-left section of the query design grid, with all the fields listed.

  4. Press Alt, J+Q, and then X. The design grid opens, with the focus in the first field. In the design grid, the Sort and Show rows are no longer available, and the Delete row is now available.

  5. When you hear “Autonumber, Row 1, Type and text,” to open the drop-down list, press Alt+Down Arrow.

  6. To delete all empty rows in the table or field:

    1. Use the Down Arrow key to select a field in the table and then press Enter. The focus moves to the next column.

    2. To move to the previous column, press the Left Arrow key.

    3. To move to the Delete row, press the Down Arrow key. When you hear “Delete colon,” to open a drop-down list, press Alt+Down Arrow.

    4. To select “Where,” press the Up Arrow key and then press Enter. The focus moves to the next column.

    5. To move to the previous column, press the Left Arrow key.

    6. To move to the Criteria row, press the Down Arrow key.

    7. When you hear “Criteria” or “Row 11, Column 1,” type Is Null.

  7. To use specific criteria in a delete query:

    1. a. To select the field with the criteria you want to for deletion, use the Down Arrow key and press Enter.

    2. b. To move to the Delete row, press the Down Arrow key. Press Alt+Down Arrow and then, to select “Where,” press the Down Arrow key and then press Enter. The focus moves to the next column.

    3. c. To move to the previous column, press the Left Arrow key.

    4. d. To move to the Criteria row, press the Down Arrow key.

    5. e. Enter your criteria. For a sample list of criteria in queries, refer to Create and run a delete query.

    6. f. To move to the Show row, press the Up Arrow key.

    7. g. Clear the Show check box for each criterion.

  8. To verify that the query returns the records you want to delete, press Alt+H, W, and then H.

  9. To run the query:

    1. Switch to Design view by pressing Ctrl+H, W, and then D.

    2. In Design view, press Alt, J+Q, and then G. A confirmation window opens, asking you to confirm the deletion of x number of rows.

    3. To delete the rows, press Enter.

  10. To save the query, press Ctrl+S. In the Save as dialog box, type a name and press Enter.

Back up your database

  1. Press Alt+F, A. The Save as page opens, with Save Database As selected.

  2. To back up the database, press B, Enter. The Save as dialog box opens, with the File name edit box selected. If you want, type a new name for the database, and then press Enter.

If you are using a read-only file or a database created in an earlier version of Access, you might get a message that it is not possible to create a backup of the database.

To revert to a backup, close and rename the original file so that the backup copy can use the name of the original version. Assign the name of the original version to the backup copy, and open the renamed backup copy in Access.

Technical support for customers with disabilities

Microsoft wants to provide the best possible experience for all our customers. If you have a disability or have questions related to accessibility, please contact the Microsoft Disability Answer Desk for technical assistance. The Disability Answer Desk support team is trained in using many popular assistive technologies and can offer assistance in English, Spanish, French, and American Sign Language. Please go to the Microsoft Disability Answer Desk site to find out the contact details for your region.

If you are a government, commercial, or enterprise user, please contact the enterprise Disability Answer Desk.

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×