Create a query in Access: your first select query

A query is a saved question to your data: which fields, which records, in what order? Once created, it returns the current state every time you open it.

In short: Create, Query Design, add the table. Each field goes into a column of the grid. In the Sort row choose Ascending or Descending. Run shows the result, Ctrl+S saves the query.

Before you start: Sort and filter in Datasheet view.

Try it now

The tables are at the top, the design grid below, just like in Access. Type the field names in the Field row, pick the sort and click Run. Below the result you see the SQL that Access makes from your grid.

Task Create a query with FirstName, LastName and City of all customers, sorted by last name from A to Z.

Customers 25 rows, 10 columns
CustomerIDCompanyFirstNameLastNameCityPostalCodeCountryCustomerSinceRegularDiscount
1NoahEvansLeedsLS1 1URUK28 Feb 2023☑0.1
2Shaw & PartnersNoahDaviesGlasgowG1 1XQUK5 Feb 2024☐0.03
3Northlight IncSophiaHallDenver80202USA30 Jun 2024☑0
4OliviaEvansBristolBS1 4DJUK29 Jun 2022☑0
5OliviaSmithLondonEC1A 1BBUK23 Sep 2025☑0
6Northlight IncMiaEvansManchesterM1 1AEUK1 Feb 2025☐0.1
7Bauer LtdAvaWilsonUK14 Oct 2024☐0.05
8LucasTaylorGlasgowG1 1XQUK2 Jul 2023☐0
9JackClarkSeattle98101USA7 Nov 2022☐0.1
10Northlight IncHenryTaylorDenver80202USA3 Nov 2022☑0.1
11Northlight IncOliverJohnsonBristolBS1 4DJUK6 Mar 2024☐0
12HenryTaylorChicago60601USA24 Dec 2023☐0
13Northlight IncNoahTaylorLondonEC1A 1BBUK12 Oct 2022☐0
14Summit ConsultingMiaSmithAustin78701USA6 Feb 2022☑0
15MiaClarkAustin78701USA9 Mar 2022☑0.05
16ChloeHallSeattle98101USA4 May 2022☐0.03
17Market Street ClinicSophiaJohnsonBoston02108USA4 Jun 2023☑0
18Roth LegalMiaWrightManchesterM1 1AEUK23 Sep 2022☑0.05
19Northlight IncGraceWrightUK16 Dec 2023☐0.03
20Northlight IncOliviaBrownBoston02108USA19 Jun 2023☐0.03
21LiamBrownBoston02108USA23 Jun 2025☐0.03
22Bauer LtdJamesJohnsonManchesterM1 1AEUK5 Jun 2025☐0.05
23NoahWilsonAustin78701USA23 May 2022☐0
24Market Street ClinicJamesSmithBristolBS1 4DJUK16 Jan 2022☐0.1
25Northlight IncSophiaHallDenver80202USA4 Aug 2025☑0

The design grid

RowMeaning
Fieldwhich field (or expression) goes into this column
Tablewhich table the field comes from
SortAscending, Descending or empty
Showticked: the field appears in the result
Criteriaa condition records must meet (next lesson)
oranother condition that applies as an alternative (level 2)

The order of the grid columns is the order in the result. If several fields have a sort, Access sorts from left to right: by the leftmost field first, and by the next one on ties.

Grid and SQL view

Every query is SQL underneath. The grid of the first exercise becomes:

SELECT Customers.FirstName, Customers.LastName, Customers.City
FROM Customers
ORDER BY Customers.LastName;

You do not have to write SQL yet. Reading along helps, though: SELECT names the fields, FROM the table, ORDER BY the sort. In level 4 you write queries directly in SQL view.

One more exercise: a price list

Task Create a price list: ProductName and UnitPrice from the Products table, most expensive product at the top.

Products 18 rows, 6 columns
ProductIDProductNameCategoryIDUnitPriceUnitsInStockDiscontinued
1Blue ballpoint pen11.20121☐
2Highlighter 4-pack13.9076☐
3Hole punch18.50237☐
4Stapler112.9061☐
5Lever arch file12.8076☑
6USB drive 64 GB29.90193☐
7Wireless mouse219.90157☐
8Keyboard234.90216☐
927-inch monitor2229.00129☐
10Headset249.0047☐
11Office chair3189.00135☐
12Desk3349.0046☐
13Mobile pedestal3129.00105☐
14Copy paper A444.5035☐
15Notepad41.90122☐
16Envelopes 100-pack46.9093☐
17Labels47.5075☐
18Laminating pouches411.90211☐
Categories 4 rows, 2 columns
CategoryIDCategory
1Office
2Tech
3Furniture
4Paper

In real Access: a query in Design view

  1. Create, Query Design. The Add Tables list appears on the right (a dialog in older versions).
  2. Double-click the table. It appears at the top as a field list.
  3. Double-click fields to add them to the grid, or drag them in. The asterisk * adds all fields at once.
  4. In the Sort row choose Ascending or Descending.
  5. Run (exclamation mark) on the Query Design tab shows the result as a datasheet. View takes you back to Design view or to SQL view.
  6. Save with Ctrl+S, for example as “Customer list”. The query then appears in the Navigation Pane.

Other ways

The Query Wizard (Create, Query Wizard, Simple Query Wizard) asks for table and fields step by step and creates the same query. You add sort and criteria in Design view afterwards. If you know SQL, write the query straight into SQL view.

Common mistakes

Misspelled field name

Type “LastNme” instead of “LastName” and Access does not know the field, so it asks for a parameter value when you run the query. That prompt is almost always a typo. Double-clicking in the field list is safer.

Sort on the wrong field

If the sort sits under City instead of LastName, the result is complete but in the wrong order. Check the Sort row in every column.

FAQ

Does a query change my data?

A select query like this one does not. But if you change a value in its result datasheet, the change goes into the table. Action queries that change data on purpose come in level 4.

How many fields can a query have?

According to Microsoft, up to 255 fields in the result. For clear lists, take only the ones you really need.

Learn next: query criteria

Show only the records that meet a condition: country, price, yes/no.

Query criteria

Write to us

Choose language

Select your preferred language