469,946 Members | 2,032 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,946 developers. It's quick & easy.

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 34772
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,800 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,800 Expert 8TB
Thank you guys!
Now it is working :)
You're welcome.
Apr 23 '07 #5

Post your reply

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

Similar topics

2 posts views Thread by Rasmus Grøndahl Olsen | last post: by
4 posts views Thread by coolsti | last post: by
5 posts views Thread by Confused User | last post: by
5 posts views Thread by Sinan Nalkaya | last post: by
9 posts views Thread by Terry Olsen | last post: by
4 posts views Thread by PJ6 | last post: by
14 posts views Thread by stephen.durkin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.