473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Forcing Wait or Delay ?

Is there a way to force Access to pause execution for a specified
period of time ? I would like a command button on a form to run it's
code when clicked and then pause for 2 seconds before allowing any
other user input. Thank you for any help.

Feb 5 '06 #1
4 20997
On Sun, 05 Feb 2006 03:54:30 GMT, Sh**********@KidNet.com wrote:
Is there a way to force Access to pause execution for a specified
period of time ? I would like a command button on a form to run it's
code when clicked and then pause for 2 seconds before allowing any
other user input. Thank you for any help.


Put the following into your code where you want the pause.

Dim T1 As Variant
Dim T2 As Variant

T1 = Now()
T2 = DateAdd("s", 2, T1)

Do Until T2 <= T1
T1 = Now()
Loop
Wayne Gillespie
Gosford NSW Australia
Feb 5 '06 #2
You could use windows api stuff...
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

....

Sleep 2000

Sh**********@KidNet.com wrote:
Is there a way to force Access to pause execution for a specified
period of time ? I would like a command button on a form to run it's
code when clicked and then pause for 2 seconds before allowing any
other user input. Thank you for any help.

Feb 5 '06 #3

Wayne Gillespie wrote:
On Sun, 05 Feb 2006 03:54:30 GMT, Sh**********@KidNet.com wrote:
Is there a way to force Access to pause execution for a specified
period of time ? I would like a command button on a form to run it's
code when clicked and then pause for 2 seconds before allowing any
other user input. Thank you for any help.


Put the following into your code where you want the pause.

Dim T1 As Variant
Dim T2 As Variant

T1 = Now()
T2 = DateAdd("s", 2, T1)

Do Until T2 <= T1
T1 = Now()
Loop


If you're going to wait for an appreciable length of time, you might
want to put a DoEvents in the loop.

Edward

Feb 6 '06 #4
I use Trevor Best's 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

Feb 6 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mark English | last post by:
Every once in a while since I moved to Python 2.4 I've been seeing the following exception in threading.py Condition: File "mctest3.py", line 1598, in WaitForMessages...
1
by: Robert Huie | last post by:
Hi all, I'm trying to use asp.net to code a chat window and I would like to make the http request delay as long as possible till the process/thread detects a new incoming message. basically...
6
by: Paul | last post by:
Hi just wondering if there is a way to set up a wait for object in vb.net as if a put a delay in between the fill and the databind things work ok, but if not the page is reloading without the...
15
by: Snuyt | last post by:
Hello, I want the program to wait a few seconds between executing code. It should look something like this: public sub xx() ...code... wait(2) 'wait 2 seconds ...code...
3
by: eross | last post by:
Noob here, I am trying to manage calls from multiple clients to my web service by only letting one execute at a time and forcing the others to wait. Code is as follows: ...
10
by: IdleBrain | last post by:
Hello all, The sleep() method hangs up the application and does not respond to events. So, I wrote a small delay loop that will allow the application to respond to events. 'Use Delay(500) to...
22
by: Jason Zheng | last post by:
This may be a silly question but is possible for os.wait() to lose track of child processes? I'm running Python 2.4.4 on Linux kernel 2.6.20 (i686), gcc4.1.1, and glibc-2.5. Here's what happened...
1
by: Villanmac | last post by:
Hi Whats the difference between the two, i forgot to test this out, basically its part of a delay for seven segemtn display which just cycles through numbers, what would be the difference between...
5
by: Jeremy | last post by:
Hi all, I have database actions that will potentially take several seconds to complete. My normal page uses AJAX so keeping the user informed of what is happening is not a problem. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.