Solved In MS Access if the VBA code is taking longer than required how do we force the code to next

The Sleep isn't native to vba, as you'll find out if you just type Sleep 1000 and try to run it, but it's available from the Windows api
Correct, it's not a built_in vba function.
 
The Sleep isn't native to vba, as you'll find out if you just type Sleep 1000 and try to run it, but it's available from the Windows api
True I'm calling it from windows API and for me its a game changer
 
Another function I use in all my Access apps is to disable the Window close X button to force users to exit the app via a command button in the apps dashboard form.

Code:
 Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, _
        ByVal bRevert As Long) As Long
    Private Declare Function EnableMenuItem Lib "user32" (ByVal hMenu As _
        Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long
    Const MF_GRAYED = &H1&
    Const MF_BYCOMMAND = &H0&
    Const SC_CLOSE = &HF060&

https://www.fmsinc.com/microsoftaccess/startup/preventclose.asp
 
Last edited:

Users who are viewing this thread

Back
Top Bottom