> ## 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.

# How to Set a Breakpoint Inside of an Access Query
- URL: https://nolongerset.com/watch-this/
- Published: 2021-03-05T04:59:54.000Z
- Updated: 2026-05-08T13:00:59.000Z
- Description: Did you ever want to set a breakpoint inside of an executing query? How about inside a form event property? This trick lets you do it.
- Author: Mike Wolfe
- Tags: Code Library, #DesignProcedures, Debugging, #Import 2026-05-20 02:59

Did you ever want to set a breakpoint inside of an executing query? 

How about inside a form or control event property? (See screenshot below.)

> My early programs are full of Event properties with direct function calls:  
>  
> ![image-9](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/03/image-9.png)  
>  
> *(excerpted from [Lightweight Forms? Just Don't](https://nolongerset.com/lightweight-forms-just-dont/))*

## The Workaround

Well, you can't set an actual breakpoint in either of those places. But you can do the next best thing: use this `Watch()` dummy function to wrap the call and place your breakpoint within the function:

```vba
Function Watch(Val, Optional CalledFrom As String = "")
    'Debug.Assert Val <> "Value to watch for"
    'Debug.Print Val, CalledFrom
    Watch = Val
End Function
```

The function simply passes the value straight through as the returned result. Depending on your circumstance, you can uncomment one of the first two lines to:

- halt execution when a certain value is passed to the function
- print the value passed to the function
- print the source of the function call (e.g., if you want to watch the values from multiple columns in the same query)

It's a surprisingly handy little function that I've found several occasions to use over the course of my VBA career.

### Performance Warning: Use For Debugging Only!

This is strictly a tool for debugging. You should be especially careful about adding this to a query that returns a lot of rows or one that is based on a linked SQL Server table. Adding VBA functions to queries based on linked SQL Server tables can force Access to copy the *entire* table contents across the network, especially if the function is applied to a column in the WHERE clause.

*Image by [Pexels](https://pixabay.com/users/pexels-2286921/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=1282260) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=1282260)*

***UPDATE*** *\[2021-12-4\]: Updated title from "Watch This!" to the clearer title, "How to Set a Breakpoint Inside of an Access Query."*