Solved

Wait Procedure ?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

705 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