473,407 Members | 2,312 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,407 software developers and data experts.

I need a wait() function

157 100+
Hello guys!

I am trying to use trevors wait function on my odbc database for a countdown function. But this function is not stable as it sometimes dosent actually wait before launching next line of code

The database is a ODBC update database which is full automatic startup/shutdown but because i sometimes want to make som edits to it i want a countdown before it shutsdown with a "cancel shutdown" code.

Expand|Select|Wrap|Line Numbers
  1. Wait(1)
  2. me.etk_information.caption = "Shutdown in 5 seconds....
  3. Wait (1)
  4. me.etk_information.caption = "Shutdown in 4 seconds....
  5. Wait (1)
  6. me.etk_information.caption = "Shutdown in 3 seconds....
  7. Wait (1)
  8. me.etk_information.caption = "Shutdown in 2 seconds....
  9. Wait (1)
  10. me.etk_information.caption = "Shutdown in 1 seconds....
  11. Wait (1)
  12. Docmd.quit
  13.  
and some more lines of code to abort shutdown..
But because the wait function isnt working properly it sometimes just flyes through all the code without waiting and my shutdown sequense is wasted
Apr 21 '07 #1
4 35767
pks00
280 Expert 100+
trevor's wait function eh, whose trevor?

what about the use of a api function like sleep

add this to a module
then call this SleepPls passing in 1 for 1second obviously!!!


Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Public Sub SleepPls(ByVal lSecs As Long)
Sleep (lSecs * 1000)
End Sub
Apr 21 '07 #2
ADezii
8,834 Expert 8TB
Hello guys!

I am trying to use trevors wait function on my odbc database for a countdown function. But this function is not stable as it sometimes dosent actually wait before launching next line of code

The database is a ODBC update database which is full automatic startup/shutdown but because i sometimes want to make som edits to it i want a countdown before it shutsdown with a "cancel shutdown" code.

Expand|Select|Wrap|Line Numbers
  1. Wait(1)
  2. me.etk_information.caption = "Shutdown in 5 seconds....
  3. Wait (1)
  4. me.etk_information.caption = "Shutdown in 4 seconds....
  5. Wait (1)
  6. me.etk_information.caption = "Shutdown in 3 seconds....
  7. Wait (1)
  8. me.etk_information.caption = "Shutdown in 2 seconds....
  9. Wait (1)
  10. me.etk_information.caption = "Shutdown in 1 seconds....
  11. Wait (1)
  12. Docmd.quit
  13.  
and some more lines of code to abort shutdown..
But because the wait function isnt working properly it sometimes just flyes through all the code without waiting and my shutdown sequense is wasted
In the Declarations Section of a Standard Code Module:
Expand|Select|Wrap|Line Numbers
  1. Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Wherever appropriate:
Expand|Select|Wrap|Line Numbers
  1. Dim intCounter As Integer
  2.  
  3. Me![txtTest] = ""
  4.  
  5. For intCounter = 5 To 1 Step -1
  6.   Me![txtTest] = "Shutdown in " & intCounter & " seconds..."
  7.   Sleep (1000)
  8.    DoEvents
  9. Next
Apr 21 '07 #3
MrDeej
157 100+
Thank you guys!
Now it is working :)
Apr 23 '07 #4
ADezii
8,834 Expert 8TB
Thank you guys!
Now it is working :)
You're welcome.
Apr 23 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rasmus Grøndahl Olsen | last post by:
I have tried to write a wait function but it seems like it will not brake the while loop. I tried two different solutions. Can anyone tell me what I am doing wrong, and come with another...
4
by: coolsti | last post by:
I am aware of the setInterval and setTimeout functions for Javascript, but I can't seem to find an example that lets me do what I need to. I have a script that needs to wait until a certain...
5
by: Confused User | last post by:
I am working on device that utilizes a Motorola 68HC16 microcontroller. I am using an old unsupported piece of crap Whitesmith's / Intermetrics / Tasking compiler. The embedded compiler business...
6
by: SP | last post by:
Hi, I want to add wait cursor code whenever page is post back. Page may be post back on my user control's or on change of dropdown or on click of any button on page. so is there any common...
5
by: Sinan Nalkaya | last post by:
hello, i need a function like that, wait 5 seconds: (during wait) do the function but function waits for keyboard input so if you dont enter any it waits forever. i tried time.sleep() but when...
10
by: HK | last post by:
With VB.NET 2005, and a Windows Form, running on a dual CPU box, I need to take a recordset (e.g. 100,000 records) and spawn a thread to handle an internet XML transaction routine for each of the...
9
by: Terry Olsen | last post by:
I'm running an asynchronous Socket. In the ReceiveCallback method, I need to append what is received to a textbox on the main form. I have this code: Private Sub ToChatWindow(ByVal msg As...
4
by: PJ6 | last post by:
This is the only solution I've found to get a wait cursor document-wide: function Busy() { if (document.all) for (var i=0;i < document.all.length; i++) document.all(i).style.cursor = 'wait'; }...
14
by: stephen.durkin | last post by:
I've gathered that javascript doesn't have a handy wait() function, so I made the following function makeDelay() to make use of PHP's sleep(), which then does the waiting, and responds with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.