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

# Demystifying DoEvents
- URL: https://nolongerset.com/demystifying-doevents/
- Published: 2021-07-13T02:21:22.000Z
- Updated: 2026-05-08T13:00:05.000Z
- Description: The DoEvents function may be the single most misunderstood piece of code in the entire VBA language. In this series of articles, I'll try to remedy that.
- Author: Mike Wolfe
- Tags: DoEvents, #Import 2026-05-20 02:59

If you've spent any time programming in Microsoft Access, you've likely run into a situation where the screen dimmed and the application title bar got updated to include the text "(Not Responding)." After some Googling, you also probably found the [simple solution](https://stackoverflow.com/a/33478041/154439): add a call to `DoEvents`.

The [DoEvents function](https://support.microsoft.com/en-us/office/doevents-function-7af41eca-88e0-470d-adaf-0b3d4c2575b0) was largely a mystery to me for a long time. I used it much like a [cargo cult programmer](https://en.wikipedia.org/wiki/Cargo%5Fcult%5Fprogramming) would. Whenever the screen dimmed and I got the dreaded "(Not Responding)" text in my application title bar, I would start throwing `DoEvents` calls into my code all willy-nilly. 

Still "(Not Responding)"? Let's throw some more `DoEvents` calls into the mix.

I was like Oprah celebrating an episode milestone, but instead of guests I was shouting to my procedures, "You get a `DoEvents` call. And *you* get a `DoEvents` call. And *you* get a `DoEvents` call!"

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/07/tenor.gif)

It's not programming. It's just magic! And I don't know what I'm doing any more!!!

Needless to say, typing random code into your editor in the hopes of appeasing the Microsoft gods is no way to develop software.

In this series of articles, I'll dive deep into the DoEvents function. I'll demystify this function so that you can start using it with intention, instead of haphazardly the way I ~~used to~~ still do sometimes.

I'm going to explore the following topics:

- [What is DoEvents](https://nolongerset.com/what-is-the-doevents-function/)
- [Where to Use DoEvents](https://nolongerset.com/doevents-demo/)
- [When to Use DoEvents](https://nolongerset.com/when-to-call-doevents/)
- [Why it Works: A High-Level Overview](https://nolongerset.com/why-doevents-works/)
- [How it Works: The Nitty-Gritty Details](https://nolongerset.com/how-doevents-works/)

*UPDATE: Bonus Articles!*

- *[DoEvents function vs. Me.Repaint](https://nolongerset.com/doevents-vs-repaint/)*

And hopefully, if all goes well, you will finally be able to get rid of those [wooden headphones](https://stevemcconnell.com/articles/cargo-cult-software-engineering/) you've been keeping around "just in case."

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/07/wooden-headphones.jpg)

*Base Image by [Susie Bailey](https://pixabay.com/users/susannahscottphoto-4689775/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=2388419) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=2388419) (wooden ball Image by [GGs\_](https://pixabay.com/users/ggs%5F-6435629/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=4127053) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=4127053)) – cartoonishly bad combination of the two images by Mike Wolfe from NoLongerSet*

---

### External references

[Access VBA Loop (Not Responding)I am looping through a recordset to carry out some basic functions or edits. Usually with recordsets with more than 50 records, access will stop responding. I have me.repaint before the loop com...![](https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a)Stack OverflowDave B![](https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon@2.png?v=73d79a89bded)](https://stackoverflow.com/a/33478041/154439)

[DoEvents FunctionThe function, method, object, or property described in this topic is disabled if the Microsoft Jet Expression Service is running in sandbox mode, which prevents the evaluation of potentially unsafe expressions.![](https://www.microsoft.com/favicon.ico?v2)Access![](https://support.office.com/SocImages/SOC_SharingImage_720x405.png)](https://support.microsoft.com/en-us/office/doevents-function-7af41eca-88e0-470d-adaf-0b3d4c2575b0)

[Cargo cult programming - Wikipedia![](https://en.wikipedia.org/static/apple-touch/wikipedia.png)Wikimedia Foundation, Inc.Contributors to Wikimedia projects![](https://upload.wikimedia.org/wikipedia/commons/thumb/3/37/JohnFrumCrossTanna1967.jpg/220px-JohnFrumCrossTanna1967.jpg)](https://en.wikipedia.org/wiki/Cargo%5Fcult%5Fprogramming)

[Cargo Cult Software Engineering | Steve McConnellIssue: March/April 2000 | PDF![](https://2h73ayp5jhv44aq9p3zmp9gd-wpengine.netdna-ssl.com/wp-content/uploads/2017/08/steve-mcconnell-favicon.png)Steve McConnellNatalie Nygren![](http://stevemcconnell.com/wp-content/uploads/2017/08/software-logo-black-220x70.png)](https://stevemcconnell.com/articles/cargo-cult-software-engineering/)

### Article references

[How to Teach a Six-Year Old About the DoEvents FunctionI challenge you to read this article without laughing or learning anything new about the DoEvents function.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/07/DoEvents.jpg)](https://nolongerset.com/what-is-the-doevents-function/)

[How to Use the DoEvents Function: A DemonstrationThe demonstration and downloadable sample code in this article make it easy to understand how DoEvents works.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/07/DoEvents-Demo.jpg)](https://nolongerset.com/doevents-demo/)

[When (or Should I Say, How Often) to Call DoEventsToo few calls to DoEvents, and your app may appear to be ”(Not Responding).” Too many calls to DoEvents, and your app will run slow. Let’s Goldilocks this thing.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/07/hans-jurgen-mager-NL1vH0hnIbQ-unsplash.jpg)](https://nolongerset.com/when-to-call-doevents/)

[A High-Level Overview of the DoEvents Function CallWhy does calling DoEvents save us from the dreaded ”(Not Responding)” treatment? It’s all about handling “Windows Messages.”![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/07/architecture-1837176_1920.jpg)](https://nolongerset.com/why-doevents-works/)

[How DoEvents Works: The Nitty-Gritty Technical DetailsA peek behind the scenes at the inner workings of the DoEvents function.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/07/macro-1452986_1920.jpg)](https://nolongerset.com/how-doevents-works/)

*Image by [PublicDomainPictures](https://pixabay.com/users/publicdomainpictures-14/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=164761) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=164761)*

***UPDATE*** *\[2021-07-21\]: Added link to bonus article, [DoEvents vs. Repaint](https://nolongerset.com/doevents-vs-repaint/)*