Solved

Wait Procedure ?

Posted on 1998-01-11
4
158 Views
Last Modified: 2012-06-27
How can i tell the progam to wait for a few second before
proceeding to the next procedure ?


for example :

for i = 0 to 100

form1.combo1.additem (variables)

next i

****wait for 5 seconds

form2.show
0
Comment
Question by:netcool
  • 2
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
Trygve earned 10 total points
ID: 1450414
Here a little function that might help

Function Wait(HowLong, interval)

    Dim StartedAt As Date
    StartedAt = Now
   
    Do Until DateDiff(interval, StartedAt, Now()) >= HowLong
    Loop

End Function

Interval:
yyyy      Year
q      Quarter
m      Month
y      Day of year
d      Day
w      Weekday
ww      Week
h      Hour
n      Minute
s      Second

Hope this helps !
Trygve
0
 
LVL 1

Expert Comment

by:redbaron082997
ID: 1450415
You may want to add a doevents inbetween the loop, that way other apps will run, and not stop.  Just a suggestion.
0
 
LVL 12

Expert Comment

by:Trygve
ID: 1450416
redbaron is right.

DoEvents will allow Windows to process all upcomming events.

BUT if the wanted delay is small (couple of seconds) I would suggest to leave it as it is (perhaps make the function check the length and doevents for surtain combinations of HowLong and interval). When windows start performing events it can go on for quit some time.
0
 
LVL 1

Expert Comment

by:redbaron082997
ID: 1450417
Good Point.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question