> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Nothing To See Here
- URL: https://nolongerset.com/nothing-to-see-here/
- Published: 2021-03-23T01:06:33.000Z
- Updated: 2026-05-08T13:05:45.000Z
- Description: Introducing InformNoData(), a simple function to improve the user experience when there is no report data to show.
- Author: Mike Wolfe
- Tags: Code Library, #ReportFunctions, #Import 2026-05-20 02:59

Did you know that Microsoft Access provides an event that fires whenever you open a bound report but all of the underlying data has been filtered out?

For example, consider the Invoice report from the Northwind sample database. The two screenshots below show the report with data (on the left) and without data (on the right):

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/03/2021-03-22-20_03_15-mjw20-Window.png)

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/03/2021-03-22-20_03_35-mjw20-Window.png)

#Type! errors on your reports look sloppy and unprofessional.

## Improving the User Experience

Showing a report with no data leads to user confusion. They'll often assume–understandably–that there's a bug in the program. However, in most cases, there simply is no data to report. 

Handling the [No Data event](https://docs.microsoft.com/en-us/office/vba/api/access.report.nodata) for a report is an easy way to improve the user experience. It's a simple thing, but explicitly telling the user there is nothing to report is a big improvement over showing a mostly empty report with some random error text.

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/03/2021-03-22-20_49_17-mjw20-Invoice.png)

Simple, generic text that can apply to any report.

## A Simple Improvement

Generating the above user messages does not require custom code for every report. Rather, we can take advantage of the **[DoCmd.CancelEvent](https://docs.microsoft.com/en-us/office/vba/api/access.docmd.cancelevent)** method and add this functionality to our reports without even having to add a code-behind to the report.

Here's the function:

```vba
'Usage: Paste the following into the OnNoData property of a report:
'       =InformNoData(Report)
Function InformNoData(Rpt As Report)
    MsgBox "There is nothing to report" & _
            IIf(Len(Rpt.Filter) > 0 And Rpt.FilterOn, _
               " for the criteria you specified", vbNullString) & _
            ".", vbInformation, Rpt.Caption
    DoCmd.CancelEvent
End Function
```

The **InformNoData()** function

To add it to your report:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/03/image-24.png)

Look, Ma! No code!

## The OpenReport Action Was Canceled

You should be aware that canceling a report in the OnNoData event will [trigger an Access error](https://nolongerset.com/the-openreport-action-was-canceled/) (2501). The easiest way to avoid seeing that error message is to use my [PreviewReport function](https://nolongerset.com/previewreport-function/).

*Screenshot of Leslie Nielsen as Det. Frank Drebin in The Naked Gun*