[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register 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
?
906 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

656 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