Problem with Form Timer

L

Louis Herndon

Hello,

I am designing a database for our Financial Dept. As it
will be used by many users, I am trying to make it as
professional as well as functional as possible. By
request of our CFO, I am attempting to make this as close
to an application as I can, as opposed to a hum-drum
database. Here is my problem:

I have made a startup splash screen that basically slowly
expands our company name with our logo as a background.
This works fine, and I then want it to pause a second or
two, and then automatically close and open the login
screen. This works as well, the only thing I am lacking
is the pause. As soon as the banner expands, it closes
immediately, not giving a chance to really see what the
banner says. Here is my code, and any help would be
appreciated:

Option Compare Database
Option Explicit
Private Sub Form_Timer()
On Error GoTo Form_Timer_Error
Me.TimerInterval = 0
If Me!lblWait.Visible = False Then
Call ShowMe
End If
DoCmd.Close acForm, "frmTest"----> How do I input the
pause???
Form_Timer_Exit:
Exit Sub

Form_Timer_Error:
MsgBox "Error in Test Form@Error when Timer expires = "
& Err.Number & "@ie:" & vbCrLf & Err.Description
Resume Form_Timer_Exit


End Sub
Private Sub ShowMe()

Dim i As Long
Me!lblWait.Visible = False
Me!lblWait.Width = 1
Me!lblWait.Visible = True
Me!fraLink.Visible = True

For i = 1 To 4000 Step 40
Me!lblWait.Width = i
Me.Repaint
Call jpDelay(1)
Next

End Sub
..
 
G

George Nicholson

See if this helps:
'this should "pause" your code for 2 seconds
Wait(2)

'**********************************
'In Declarations section of a module:
Declare Function GetTickCount Lib "kernel32" () As Long
'**********************************
Public Function Wait(ByVal seconds As Long) As Boolean
' adapted from Access-Office-VB Advisor "Tips" Dec 1998

' Uses API Declaration:
' Declare Function GetTickCount Lib "kernel32" () as Long
' GetTickCount = # milliseconds since Windows has started.
' GetTickCount wraps to zero approx every 49 days.

On Error Resume Next
Dim StartTime As Long
Dim Elapsed As Long

StartTime = GetTickCount
Elapsed = 0
Do While (Elapsed < seconds)
'Convert to seconds
' Use integer math for speed
Elapsed = (GetTickCount - StartTime) \ 1000
DoEvents
Loop
End Function
'*******************************
HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top