The DoEvents function allows for other Windows applications and current program processing to continue (including inline events) while code is sequenced. Most often used in looping code of some form or another. Sometimes, it is necessary to allow for other events to update (keep current) of what is going on or being processed.
You may sometimes find that code will over-run or get ahead of itself. For example. You may open a form and immediately after the code line that opens the Form, you have a line that accesses the Form. It may sometimes fail simply because the form is not fully loaded yet due to other heavy processing in the backgound when the second line fires. Keep in mind, this is just a scenario. The DoEvents can assist you here. For example: