Others

Create an Access Query to Show All Years Including Blanks

Elise WilliamsElise Williams Oct 23, 2026 869 views

Question details

The user wants to generate an Access query that displays every year sequentially (e.g., 2020 through 2030), ensuring that years with no matching records in the source data still appear in the results as blanks.

How to Create an Access Query Showing All Years Including Blank Results
Product
Microsoft Access
Device & OS
not provided
Scenario
Generating a grouped summary report by year where the source table lacks data for certain years within the desired reporting timeline.
Observed behavior
Standard inner joins omit years that lack corresponding data, preventing a continuous, uninterrupted timeline from appearing in the final query results.
Before you start

Identify the source table or query containing your data, specifically noting the date or year field (Field A) and the value field you wish to summarize (Field B).

Solution 1Recommended

Use a Dedicated Year Table and a Left Join

By creating a standalone table containing all desired years and joining it to your data with a Left Join, you force Access to display every year regardless of missing source data.

A common mistake is attempting to group solely by the source table's year field. If no data exists for a specific year, the query cannot pull it. Creating a master 'tblYears' ensures every year acts as the anchor for your totals.

1
Create the master year table

Create a new table named tblYears. Add a Long Integer field named TheYear and set it as the primary key. Switch to Datasheet View and populate it sequentially with your target years, such as 2020 through 2030.

2
Set up the query design

Navigate to Create > Query Design. Add both the newly created tblYears and your source table or query into the design workspace.

3
Configure a Left Join

Click and drag TheYear from tblYears to the corresponding year field (Field A) in your source table to create a relationship. Double-click the join line connecting them and select the option to 'Include ALL records from tblYears and only those records from the source where the joined fields are equal'.

4
Add fields to the query grid

Drag TheYear from tblYears into the first column of the query grid and set its Total row to 'Group By'. Drag the value field (Field B) from the source table into the second column and set its Total row to 'Sum'.

5
Omit the source year field

Ensure you do not add the year field (Field A) from the source table to the query grid. The grouping must rely exclusively on tblYears.TheYear to correctly display the blank entries.

Use a Dedicated Year Table and a Left Join
Enable the Totals Row: If you do not see the Total row in the bottom query grid, click the 'Totals' button (the Sigma icon) located in the Show/Hide group on the Query Design ribbon.
Free Microsoft Office alternative

Looking for a Free and Lightweight Office Suite? Try WPS Office

While relational databases require programs like Microsoft Access, WPS Office is an excellent, free alternative for your daily document, spreadsheet, and presentation tasks. It offers robust data analysis tools like PivotTables in Spreadsheets for flat-file database management without the heavy subscription costs.

  1. 1. Download WPS Office: Visit the official WPS Office website and download the free installation package for your operating system.
  2. 2. Install the software: Run the downloaded installer and follow the straightforward on-screen instructions to complete the setup.
  3. 3. Analyze your data: Open WPS Spreadsheet, import your exported database records, and utilize features like PivotTables to summarize data by year.
Completely free and lightweight office suite for Windows, Mac, and Linux systems.Highly compatible with Microsoft Office formats, including .docx, .xlsx, and .pptx.Powerful spreadsheet capabilities to sort, filter, and summarize exported database reports.Familiar tabbed interface ensures a quick and seamless transition.
microsoft office alternative - wps office

Frequently Asked Questions

Why do standard Access queries skip years without data?

By default, Access creates an Inner Join when linking tables. An Inner Join only returns rows where there is a matching value in both tables. If a specific year lacks data in the source table, the Inner Join excludes that year entirely from the results.

Can I show a zero instead of a blank for missing years in the query?

Yes. In the query design grid for your value field (Field B), you can wrap the calculation in the Nz() function. For example, typing Nz(Sum([Field B]), 0) forces Access to display a zero instead of leaving the field blank when no records exist.

Does WPS Office have a direct alternative to Microsoft Access?

WPS Office primarily focuses on Word processing, Spreadsheets, and Presentations. While it doesn't include a direct relational database management system like Access, WPS Spreadsheet provides comprehensive data filtering, lookup formulas, and PivotTables that handle most flat-file data management and reporting needs.