Use the DoEvents Command to Yield Execution to Other Processes During Loops in Microsoft Access

  Рет қаралды 3,157

Computer Learning Zone

Computer Learning Zone

Күн бұрын

In this Microsoft Access tutorial I'm going to teach you how to use the DoEvents command inside of a loop to yield execution to the database so that it can do stuff like update the screen and show your user that the database is busy doing something and not necessarily locked up.
NOTES:
I didn't think of adding this until after I finished recording and posting the video but a few people have asked me if they can use DoEvents to allow the user to continue working in the database while something runs in the background. While this is technically possible I don't recommend it. If you've got one loop running an Access I would just let it run and do its thing. If you try to do other work while that loop is running, especially if it's updating the screen, you may lose focus on an important field that you're typing in and other weird stuff can happen. Fortunately, Windows is really good at multitasking so what you could do is open a second database and work on that one while your first database does its thing. And of course you don't want to modify anything that has to do with the records that that loop is working on.
BECOME A MEMBER:
KZbin: / @599cd
or My Site: 599cd.com/THMember
LEARN MORE:
599cd.com/DoEvents
PREREQUISITES:
Intro to VBA: 599cd.com/IntroVBA
For Next Loops: 599cd.com/ForNext
If Then: 599cd.com/IfThen
Variables: 599cd.com/Variables
RECOMMENDED COURSES:
Access Developer Courses: 599cd.com/Developer
FREE TEMPLATE DOWNLOADS:
TechHelp Free Templates: 599cd.com/THFree
Blank Template: 599cd.com/Blank
Contact Management: 599cd.com/Contacts
Order Entry & Invoicing: 599cd.com/Invoicing
More Access Templates: 599cd.com/AccessTemplates
ADDITIONAL RESOURCES:
FREE Access Beginner Level 1: 599cd.com/Free1
How to Use Access in 30 Minutes: 599cd.com/30Minutes
$1 Access Level 2: 599cd.com/1Dollar
Donate to my Tip Jar: 599cd.com/TipJar
Get on my Mailing List: 599cd.com/YTML
Contact Me: 599cd.com/Contact
TechHelp: 599cd.com/TechHelp
Consulting Help: 599cd.com/DevNet
Twitter: / learningaccess
en.wikipedia.org/wiki/Microso...
products.office.com/en-us/access
microsoft.com/en-us/microsoft...
KEYWORDS:
access 2016, access 2019, access 2021, access 365, microsoft access, ms access, ms access tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, What is the DoEvents function, not responding, yield execution, mod, modulus, for next, if then, variables
QUESTIONS:
Please feel free to post your questions or comments below. Thanks.

Пікірлер: 17
@Shadow.Dragon
@Shadow.Dragon Жыл бұрын
Thanks for the video! I really liked the use of "Mod" to not display every "print" item.
@alanhill769
@alanhill769 Жыл бұрын
I came across this problem when I was scanning several folders on different hard drives to add videos into my database. I used SysCmd acSysCmdSetStatus I got a progress update in the bottom left hand side telling me how far the drive scan had progressed. But I do like DoEvents I am going to play with it. I do think the screen is a better place to display information. There always appears to be an easier way to do stuff in Access. I have found Richard Rost often has the simplest solutions. In fact Microsoft is probably the last place to look to solve your problems. There is always an easier way. Thank you.
@599CD
@599CD Жыл бұрын
Microsoft's website has a lot of great technical information but not a lot of how to. Which is okay because that's where I come in. LOL. I liken Microsoft's website to a reference book that's not necessarily great for learning something but good for looking something up once you kind of already sort of know how to do it.
@alanhill769
@alanhill769 Жыл бұрын
@@599CD That reminds me of when I was a kid. If i could not spell a word, how could I find it in the dictionary? You have to know how the word is spelt to find it. Then you don't need a dictionary do you? Unless you need to find out what the word means. A bit like my programming. I have several routines some I do not understand exactly how they work but they do. That's good enough for me. I think people use words and they have no idea what they mean but they use them anyway. Have a great day.
@GlobusMark
@GlobusMark Жыл бұрын
That’s even better then the calculator! 😊 Thank you! Great video! 👍
@599CD
@599CD Жыл бұрын
You're very welcome
@nickbroekhuizen8858
@nickbroekhuizen8858 Жыл бұрын
Thanks, Richard, I've learned something new ... thanks. :)
@599CD
@599CD Жыл бұрын
You're very welcome
@torstenkrumel6970
@torstenkrumel6970 Жыл бұрын
Very helpful ❤
@599CD
@599CD Жыл бұрын
Thanks
@saneneweyes6189
@saneneweyes6189 Жыл бұрын
It's not exactly related to this video (what with the DoEvent function), but it made me want to put an abort function for a subroutine (and a series of related subroutines, toggled by checkboxes, within the main subroutine) utilizing a long series of followhyperlink / sendkeys / sleep functions to perform searches in a nuymber of online repositories. The aim is to help minimize some of the redundant tasks for my end users.
@599CD
@599CD Жыл бұрын
Yeah I put abort buttons near anything that runs in Loops or has lots of steps
@Stache987
@Stache987 Жыл бұрын
I'd suggest a on screen display updated every 20 seconds or so displaying the time so a user knows the process is moving
@599CD
@599CD Жыл бұрын
Yep you could indeed use time as a counter variable in fact someone else already asked me how to do this a little while back and it's on my list for a video so stay tuned
@Stache987
@Stache987 9 ай бұрын
The doggy doorman works for free BTW
@599CD
@599CD 9 ай бұрын
He gets paid in treats.
@Stache987
@Stache987 9 ай бұрын
@@599CD our pets treats are called "candy" to them, as for human food, they get dibs on cleaning the dishes first
While Wend Loops in Microsoft Access VBA
18:44
Computer Learning Zone
Рет қаралды 2,2 М.
Was ist im Eis versteckt? 🧊 Coole Winter-Gadgets von Amazon
00:37
SMOL German
Рет қаралды 39 МЛН
孩子多的烦恼?#火影忍者 #家庭 #佐助
00:31
火影忍者一家
Рет қаралды 51 МЛН
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 21 МЛН
MS ACCESS MULTIPLE TABLE QUERY
13:01
Topper Tutorial
Рет қаралды 111
What is Redis and What Does It Do?
6:47
CBT Nuggets
Рет қаралды 248 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 87 М.
Was ist im Eis versteckt? 🧊 Coole Winter-Gadgets von Amazon
00:37
SMOL German
Рет қаралды 39 МЛН