Solved

Wait Procedure ?

Posted on 1998-01-11
4
157 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

815 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now