Another Access 2007 Question on Timers

jjc9809
jjc9809 used Ask the Experts™
on
Hi Everyone,

I have an Access 2007 application where I have a form called a "CoverSheet" that loads.
I have a Label on the form that flashes in Red with a Timer on the load event set to an interval "500".  The Message that flashes is "Check for New Stores or changes to stores".

However I want this flashining to cease after about 2 minutes and not flash any longer.
What is the coding to do this or property to do this?  I just do not want the flashing to continue all of the time.  When the user sees it, I want it turned off and not just keep flashing, becuase the user will come back to this coversheet for other things and the coversheet remains open while the application is running.

jjc9809
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Nerd
Most Valuable Expert 2012
Top Expert 2013
Commented:
In the timer event, these aare the lines to add:


Private Sub Form_Timer()
   Static intCount As Integer      
   intCount = intCount + 1

    ' Your Timer event code goes here

' turns off the timer after the event has been called 240 times (2 minutes)
  If intCount > 240 then 
         Me.TimerInterval = 0  
         intCount = 0
  end if
End Sub

Open in new window

You could add a static variable to be used as a counter in your OnTimer event and increment it each time.  Once the counter gets to 120, which is equivalent to 2 minutes with the interval set to 500, you would set your TimerInterval to 0.  This solution is only good if your timer event is not used for any other purpose.

Static cnt as Integer

cnt = cnt +1
If cnt = 120 then
     Me.TimerInterval = 0
     cnt = 0
End If

You could add an OnClick event to your flashing label to set the TimerInterval to 0.

Just curious.  Couldn't your program check for new stores or changes to stores and then inform the user that this is the case?  Or is that information not in tables?

Author

Commented:
This works great!

Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial