How to Use Sleep to Pause VBA in MS Access

  Рет қаралды 4,814

Sean MacKenzie Data Engineering

Sean MacKenzie Data Engineering

Күн бұрын

Пікірлер: 13
@robertzimmerman8910
@robertzimmerman8910 2 жыл бұрын
I get errors right off the bat since I'm on Windows 10 64 bit and the kernel32.dll declaration blows up with a cryptic error message about LongPtr and 64 bit declarations
@seanmackenziedataengineering
@seanmackenziedataengineering 2 жыл бұрын
For 64-bit installations, you can try using: Private Declare PtrSafe Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long) Note PtrSafe added to the beginning of that line. It is for declarations in 64-bit Office installations.
@ValmisFilm
@ValmisFilm 2 жыл бұрын
how can I use Sleep over the whole workbook? At this point, I must add this declaration to each module.
@seanmackenziedataengineering
@seanmackenziedataengineering 2 жыл бұрын
Instead of Private Declare, try using Public Declare. Then you can call it from anywhere. You will need to delete the declaration from all other modules. Great question!
@ValmisFilm
@ValmisFilm 2 жыл бұрын
@@seanmackenziedataengineering Thank you! Like "Public Sub" - I just understood that all these years I did this one wrong :D
@kassemaubaid9217
@kassemaubaid9217 Жыл бұрын
hello Sir MacKenzie.. I dont know for what we use sleep function
@seanmackenziedataengineering
@seanmackenziedataengineering Жыл бұрын
Sometimes, you want to pause your code. Maybe you need to wait for some other external process to finish before your code can continue. Maybe your code triggers another process at the start of execution, then checks the result of that process at the end before you can continue. You know the process always takes 3 seconds to complete. So, you can start your code (which triggers the process) then sleep for 4 seconds before it consumes data from the external process (simple example and it assumes the process always takes 3 seconds).
@stephanies6316
@stephanies6316 3 жыл бұрын
Thank you for sharing .... this solved my problem
@seanmackenziedataengineering
@seanmackenziedataengineering 3 жыл бұрын
You're welcome! Glad it helped, cheers
@janezklun
@janezklun 3 жыл бұрын
Good one, thank you for sharing
@seanmackenziedataengineering
@seanmackenziedataengineering 3 жыл бұрын
Glad it helped!
@kamleshjain6872
@kamleshjain6872 3 жыл бұрын
Nice... useful when you want user to wait...
@seanmackenziedataengineering
@seanmackenziedataengineering 3 жыл бұрын
Definitely!
How to Use Base64 in Microsoft Access
29:22
Sean MacKenzie Data Engineering
Рет қаралды 1,4 М.
Class Modules in VBA: Made Super Simple
17:43
Excel Macro Mastery
Рет қаралды 37 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
PHP Tutorial: Creating a WordPress Block Type
21:20
LearnWebCode
Рет қаралды 1,9 М.
Using the Sleep Function to Make Your Database Wait in Microsoft Access VBA
21:08
VBA for Wait - How to pause VBA program
7:19
Excel Destination
Рет қаралды 23 М.
How to Use BOF and EOF on Recordsets in MS Access
10:01
Sean MacKenzie Data Engineering
Рет қаралды 5 М.
5 Killer Excel VBA Tips Everyone Should Know
12:55
Excel Macro Mastery
Рет қаралды 111 М.
Master VBA Debugging in 20 Minutes
22:08
Excel Macro Mastery
Рет қаралды 40 М.
How to Run Scripts and Open Other Applications from MS Access Using VBA
10:35
Sean MacKenzie Data Engineering
Рет қаралды 6 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН