Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form opening speeds........

Status
Not open for further replies.

AFKAFB

Programmer
Aug 22, 2005
26
US
Hi
This may sound odd as most developers want a system to run as fast as possible.
I've a number of forms that the user works through to navigate their way through the App.
When the user selects a button i want the app to pause for say 5 seconds before it openS the next screen.
How do you that.
chris
 
Chris
Have you tried code on the OnTimer event?

Tom
 
Hi Tom
Thanks for that but how would it work.
say i click on cmd_open_formA()
what would the code look like to set the timer....
sorry for being well useless on this.
regards
chris
 
chris
Go into VBA. Select Help and search for Timer. That will show you how to make Timer events.

I would assume that, in your case, you would put code on the Timer event for your form, and also on your buttons by which the user selects a second form.

As an example, I have code that flashes a message on a Save button. Here is the code on the form's Timer event.
Code:
Private Sub Form_Timer()
Me.lblSaving.Visible = True
DoCmd.Hourglass True
Me.TimerInterval = Me.TimerInterval - 5
If Me.TimerInterval = 0 Then
Me.lblSaving.Visible = False
DoCmd.Hourglass False
End If
End Sub

And here is the code on the Save command button.
Code:
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
Me.TimerInterval = 100
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.cmdNew.Enabled = True
If Me.NewRecord Then
If Me.RecordsetClone.Restartable Then
Me.RecordsetClone.Requery
DoCmd.GoToRecord , , acLast
End If
End If


Exit_cmdSave_Click:
    Exit Sub

Err_cmdSave_Click:
    MsgBox Err.Description
    Resume Exit_cmdSave_Click
    
End Sub

Timer events can be a little tricky, but play around a little and you can get it to work.

Tom

 
Could be done with the Sleep API too, I should think. For it to be publicly available, paste the following declaration into the declaration section of a standard module (not forms/reports module, but in VBE - Insert | Module)

[tt]Public Declare Sub apiSleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)[/tt]

Then, whenever/wherever you need a pause (in the program that is;-))

[tt]apiSleep 5000[/tt]

Roy-Vidar
 
or perhaps:
Code:
[blue]Function Wait (Delay As Integer)
   Dim DelayEnd As Double
   
   DelayEnd = DateAdd("s", Delay, Now)

   While DateDiff("s", Now, DelayEnd) > 0
   Wend

End Function[/blue]

Calvin.gif
See Ya! . . . . . .
 
Let me add a bit too
Code:
Public PauseAndGo As Integer
'================================
Private Sub cmdPauseAndGo_Click()
PauseAndGo = 0
Me.TimerInterval = 1000
End Sub
'================================
Private Sub Form_Timer()
PauseAndGo = PauseAndGo + 1000
If PauseAndGo = 5000 Then
MsgBox "It is time to do the Action"
Me.TimerInterval = 0
End If
End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
You may be the boss' pet; but you are still an animal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top