By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,844 Members | 1,859 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,844 IT Pros & Developers. It's quick & easy.

Best way to make Access 2.0 code wait 10 seconds before processing the next line???

P: n/a
MLH
Best way to make Access 2.0 code wait 10 seconds before processing the
next line???

For i=1 to whatever : next i
is just too processor intensive.

Isn't there something less taxing
I can use???
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Trevor Best wrote some great code to do this a while ago. Here's that
code:
Sub WaitFor(psngSeconds As Single)
' wait for specified number of seconds
' Copyright Trevor Best (tre...@besty.org.uk) <-OK, so I added
thisline.

Dim sngStart As Single
Dim sngET As Single

sngStart = Timer
DoEvents
Do While sngET < psngSeconds
DoEvents
' check for mighnight as the Timer() function will
' rollover at this point
sngET = Timer - sngStart
If sngET < 0 Then
' it rolled over - add number of seconds
' in a day
sngET = sngET + 86400
Beep
End If
' now don't hog the processor
' release some CPU slices back to Windoze
DoEvents
Loop

End Sub

Hope that helps.

Jeremy

Nov 13 '05 #2

P: n/a
MLH
I just thought of something...
What effect on the processor does it have if
I open a form in a_dialog window mode that
closes itself in 10 seconds? That doesn't
load up the processor, does it?
Nov 13 '05 #3

P: n/a
MLH wrote:
I just thought of something...
What effect on the processor does it have if
I open a form in a_dialog window mode that
closes itself in 10 seconds? That doesn't
load up the processor, does it?


Shouldn't do no.

As well as my function posted by Jeremy, there's a Ain API call called
Sleep, this uses milliseconds but has one (possible) major drawback,
while it releases CPU slices to other applications it doesn't allow
Access to process any messages, which means you won't be able to press
any cancel button if you had one and while the app would sit there using
no CPU cycles it would appear as "not responding" in task manager.

--
This sig left intentionally blank
Nov 13 '05 #4

P: n/a
MLH
<snip>
Well, thanks to you both.
You sure helped me out!
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.