Access VBADiscuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
It's worth mentioning that looping with DoEvents in the middle is going to tie up your CPU, using the API method will not.
Private Declare Sub APISleep Lib "kernel32" Alias "Sleep" (ByVal lngMilliseconds As Long)
Public Function Sleep(lngSeconds As Long) As Boolean
If lngSeconds > 0 Then
Call APISleep(lngSeconds * 1000)
Sleep = True
Why not just try "For loop structure", something like
For j = 1 To 10000000
it can be last for a while.
hope it can be helpful
The problem with this approach is that it will not give you constant results for the amount of delay.
Back in the days of the first PC's ( old XT's) your method was a common practice. Then the 286 machines cam out. The processor were so much faster that the loops like you suggest we being performed very fast. Games were executing so fast the human could not keep up. You have to run a special program to script the processor to slow it down enough that a humans could keep up. Games had to be rewritten to pause based in the passing of time. Once this method was used games were still be playable on the newer and faster CPUs.