By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,561 Members | 3,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,561 IT Pros & Developers. It's quick & easy.

timer , delay in VBA

100+
P: 553
How to set a delay between 2 statements.

If i want to put a delay b/w 2 commands, e.g

Open Form

Wait 1 min

Close form


Help please?

Thanks
Jul 20 '07 #1
Share this Question
Share on Google+
3 Replies


JKing
Expert 100+
P: 1,206
All forms have an On_Timer event and a property called TimerInterval that you can set to accomplish this.

TimerInterval specifies the time in miliseconds that the form should wait before executing the On_Timer event code. Setting the TimerInterval programmatically or through the properties window to 60000 would cause the form to wait 1 minute before firing off the event. If you just want to close the form in the event it would simply be.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.     DoCmd.Close
  3. End Sub
  4.  
Jul 20 '07 #2

100+
P: 553
JKing
and how would i set timer between 2 statements
e,.g

statement 1 - does something

delay

statemen 2 - does something

All forms have an On_Timer event and a property called TimerInterval that you can set to accomplish this.

TimerInterval specifies the time in miliseconds that the form should wait before executing the On_Timer event code. Setting the TimerInterval programmatically or through the properties window to 60000 would cause the form to wait 1 minute before firing off the event. If you just want to close the form in the event it would simply be.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.     DoCmd.Close
  3. End Sub
  4.  
Jul 20 '07 #3

JKing
Expert 100+
P: 1,206
It would be something like:

First event
Statement 1 happens
Set TimerInterval = 1000

Timer event
Statement 2 happens
Set TimerInterval = 0
Jul 20 '07 #4

Post your reply

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