[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

What happens when you set the timer event in MS/Access (VBA) to 0?

Posted on 2009-04-08
3
Medium Priority
?
909 Views
Last Modified: 2013-11-27
I'd like to know if setting the VBA Timer event actually causes an internal event handler to do something.  Would there be any reason or benefit to setting the timer to 0?  Does anything happen, does it happen really really fast, or does nothing happen at all?
0
Comment
Question by:rdbrunet
3 Comments
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 75 total points
ID: 24100800
disables it
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 150 total points
ID: 24103348
(No points wanted)

If you have it set to a value in Code:
Say, 3000 (3 seconds), then evey 3 seconds the code runs.
As rockiroads states, setting it to zero in the code will disable it.

The same is true for settng it in the Form properties.
If you notice; the TimerInterval property of a form is set to Zero (0) by default (disabled)
;-)

So to clarify, setting the Timer Interval to zero does not trigger any event handler.
In fact, setting it to zero is the only way that I know of to disable it.
For example, if you wanted to turn off the timer, what else besides setting it to zero would you use?
;-)

JeffCoachman
0
 

Assisted Solution

by:EddieGee001
EddieGee001 earned 150 total points
ID: 24111128
As rockiroads says, setting the interval to zero disables it.

I would add that this is the whole point. For example, on an Access form, you might want to have a control disappear once it has lost focus. You can't set the visible property to false in the lostfocus event because when the event triggers the control still has focus. Instead, when the control first is made visible, you move the focus to it and then set the timer interval to a short number, say 30. Then, you use this timer function:

Private Sub Form_Timer()
    If Me.ActiveControl.Name <> "theControl" Then
        Me.theControl.Visible = False
        Me.TimerInterval = 0
    End If
End Sub

As long as the control has focus, it will be the ActiveControl and nothing will happen, but the timer function will keep cycling through. As soon as another control has focus, The timer function will make the control invisible. It will then set the interval to 0 so the function will no longer be invoked.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question