-
I'm calling the "sleep" function in VB script in Access.
I've declared the library as the following:
Declare Sub sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
And then called sleep from a function:
Sleep(1000)
I get a run-time error 453 - Can't find DLL entry point...
I guess it can't find the sleep procedure in kernel32.dll..But where would it be? Any help would be appreciated thanks.
-
Try declaring it like so...
Code:
Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
-
No it exist in the Kernel32 library. The thing is that all API declarations are case sensitive. Make sure you declare it exactly like this:
Code:
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
That is change sleep into Sleep with a capital S.
Good luck!
-
You know what? It's working thanks. Funny thing. I did add the alias at first, but it automatically dissappeared everytime I added it. Now it stayed.
I also tried it with the S, not s. Thanks. i didn't realize it's case sensitive.
-
VB always automatically takes away the alias if the alias is spelled exactly like the sub or function name. So in this case it would remove it:
Code:
Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
But in this way it would remain:
Code:
Public Declare Sub sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
Again it's because the declaration (on Win32) is case sensitive.