Display time countdown in label caption

aman

Registered User.
Local time
Today, 04:28
Joined
Oct 16, 2008
Messages
1,251
Hi guys

I hope anyone can send me code for this. When I click on Close button then it should display the countdown from 10 sec to 1 sec in a label caption and then after that just close the form.

Thanks


 
Here's an alternative. If the label is called lblShowSeconds then your code will look like this:
Code:
Option Compare Database
Option Explicit

Private TotalTime As Integer

Private Sub Form_Timer()
    Me.lblShowSeconds.Caption = TotalTime   ' Show on label
    
    TotalTime = TotalTime - 1   ' Decrement
    
    If TotalTime = 0 Then
        Me.TimerInterval = 0    ' Turn off the form's timer if it's reached 0
    End If
End Sub

Private Sub lblShowSeconds_Click()
    TotalTime = 10      ' Set it to 10 so it decrements every second in Timer event
    Me.TimerInterval = 1000     ' Run every second
End Sub
 
Hello vbaInet

Thanks for your response. Actually I am building an application in excel as a frontend and Access as a backend. So I think the code you sent me over would not work. Could you modify the code so that will work on Excel.

Thanks a lot.
 
Why are you using Excel as your front end? You are limiting your caperbilities tremendously.:eek:
 
Hi Dcrake

In my company almost everyone got access to Excel spreadsheet but just few have MS Access installed on their systems. And also because my Manager asked me to develop the application in Excel as a fronend and Access backend.

Any help would be much appreciated.

Thanks
 
Time to spend some money and get Access on all machines. You are going to find it very difficult to deploy new versions, especially if you are using the personal.xls to store your modules, forms, etc.
 
tbh, if you are trying to manipulate and manage data, then access IS the tool.

Excel is not the right tool to manage a complex set of data tables
 

Users who are viewing this thread

Back
Top Bottom