Others

How to Use an Access Crosstab Query for Multiple Worksheet Codes

Aamir Naveed AkramAamir Naveed Akram Oct 22, 2026 869 views

Question details

The user needs to extract and summarize expense data for multiple specific worksheet code values (WKSHT_CD) using an Access crosstab query.

How to Use an Access Crosstab Query for Multiple Worksheet Codes
Product
Microsoft Access
Device & OS
not provided
Scenario
Creating a crosstab query to summarize financial or expense records across multiple worksheet codes without treating the codes as external Excel files.
Observed behavior
The query needs to produce a separate result row for each WKSHT_CD by correctly grouping and filtering the data from the master table.
Before you start

Ensure you have your master data table and any auxiliary tables (like column ranges or department headings) properly linked in your database before modifying the query.

Solution 1Recommended

Group and Filter the WKSHT_CD Field in Your Crosstab Query

Add the worksheet code field directly to your query's SELECT and GROUP BY clauses, then filter using an IN expression to retrieve specific expense records.

A common point of confusion is treating a table field named 'Worksheet' or 'WKSHT_CD' as an actual Microsoft Excel worksheet. In Access, this is simply a data column within your master table. By explicitly adding this field to your query structure, you can generate separate rows for each unique code.

1
Open Query Design

Open your Microsoft Access database, locate your crosstab query in the navigation pane, right-click it, and select Design View or SQL View.

2
Add the Field to SELECT and GROUP BY

Ensure the WKSHT_CD field (e.g., HOSP10_2020_NMRC.WKSHT_CD) is added to both the SELECT and GROUP BY clauses of your query.

3
Apply an IN Filter

In the Criteria row for the WKSHT_CD field, apply an IN expression to filter for multiple specific values. For example, type IN ("B000001","S300001").

4
Keep Auxiliary Tables

Make sure to keep your auxiliary tables (such as CLMN_NUM_B2) included in the query to preserve necessary column ranges and department headings.

5
Run the Query

Click the Run button in the Design ribbon to execute the query. You should now see a separate result row for each specified WKSHT_CD.

Group and Filter the WKSHT_CD Field in Your Crosstab Query
Query Structure Tip: Using the IN operator is the most efficient way to query multiple, specific text values within a single criteria field.
Free Microsoft Office alternative

Try WPS Office for Free and Efficient Data Management

If you are looking for an intuitive way to manage, analyze, and pivot your expense data outside of Microsoft Access, WPS Office is an excellent choice. It provides a lightweight, highly compatible alternative to Microsoft Office, making it easy to handle complex spreadsheets and data reports.

  1. 1. Download and Install: Get WPS Office for free from the official website and install it on your device.
  2. 2. Open WPS Spreadsheet: Launch WPS Spreadsheet to handle your financial and expense records seamlessly.
  3. 3. Analyze Data: Use the built-in Pivot Table feature to create cross-tabulated reports similar to Access crosstab queries.
Free Microsoft Office alternative with a familiar user interface.Fully compatible with Microsoft Excel formats (.xls, .xlsx, .csv).Powerful Pivot Tables for cross-tabulating and summarizing financial data.Lightweight installation with fast, reliable performance.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my Access query confusing the table field with an Excel worksheet?

This often happens due to naming conventions. If a database table field is named 'Worksheet' or 'WKSHT_CD', it simply refers to a data column within the master table, not an actual Microsoft Excel worksheet file. Always treat it as a standard table field in your SQL statements.

How do I filter multiple specific values in a Microsoft Access query?

You can use the IN operator within the criteria of your query design or SQL view. For example, typing IN ("Value1", "Value2") will return records that match either of those specific values without needing to create multiple OR statements.

Can I keep auxiliary tables in an Access crosstab query?

Yes, you can include auxiliary tables in your query to provide column ranges, lookup values, or department headings. Ensure they are properly joined to your master data table so the crosstab query accurately groups the results.