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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to create a popup "msgbox" that counts down and closes app? 1

Status
Not open for further replies.

Jrs2nd

Technical User
Feb 15, 2001
33
0
0
US
I am trying to create my own msgbox to Popup and display decreasing numbers: 10 , 9, 8, 7,.....and when it reaches
Zero the Application closes the following is the code I have written so far but, no joy. any help would be apreciated. (timer interval = 1000)not sure if it's right
have not worked out the display of numbers to coinside with the countdown yet.. trying to get the timer to count
and close first.
here's the code so far:

Private Sub Form_Open(Cancel As Integer)
Call Form_Timer
End Sub

Private Sub Form_Timer()
On Error GoTo Err_Form_Timer
' Enable security to allow manager or developer to stay "UP".
Set GlobalProps = GlobalProperties
If GlobalProps.CurrentUser = "Manager" Or "developer" Then
GoTo Form_Timer_Exit
Else
End If


' CountDown determines how much time to wait before
' running the Countdwon close subroutine.

Const CountDown = 10

Static CountDownTime
Dim CountDownSeconds


CountDownTime = CountDownTime + Me.TimerInterval

' Does the total expired time exceed the CountDown?
CountDownSeconds = CountDownTime / 1000

If CountDownSeconds >= CountDown Then

' ...if so, then reset the expired time to zero...

CountDownTime = 0

' ...and call the Countdown close subroutine.

Call ExitApp
End If

Form_Timer_Exit:
Exit Sub

Err_Form_Timer:
dbsSecurity_ErrorHandler Err.Number, Erl, Error, Me.Name, "Form_Timer"
GoTo Form_Timer_Exit

End Sub


Sub ExitApp()
On Error Resume Next
'Application.Quit (use in completed form... just close the form for now)
DoCmd.Close

End Sub



 
Got it working After changing

If GlobalProps.CurrentUser = "Manager" Or "developer" Then
to
If CurrentUser = "Manager" Or CurrentUser "Developer" Then

For displaying the countdown, create a textbox, set enabled to No, and add the code

Else
Me.[name textbox] = CountDown - CountDownSeconds

after

If CountDownSeconds >= CountDown Then
CountDownTime = 0
Call ExitApp

Grtz,

Kalin Grtz,

Kalin
 
Forgot the equalsign (=) after the second CurrentUser Grtz,

Kalin
 
Kalin,
Thanks!! worked like a charm. I appreciate the time you took to help.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top