Any "quirsk" with the timer control

Folks

I'm putting a timer on the main form of my utility.  Are there any
quirks I should know about?

I ask because there is an interesting quirk with the timer event in
Access that developers need to know about.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
0
Tony
9/5/2010 6:51:33 PM
vb.general.discussion 1016 articles. 0 followers. Follow

16 Replies
856 Views

Similar Articles

[PageSpeed] 23

On Sun, 05 Sep 2010 12:51:33 -0600, Tony Toews
<ttoews@telusplanet.net> wrote:

>Folks
>
>I'm putting a timer on the main form of my utility.  Are there any
>quirks I should know about?
>
>I ask because there is an interesting quirk with the timer event in
>Access that developers need to know about.
>

Ha, yes there are many "quirks" with a timer.

Most deal with whether a timer will fire or not (blocked) in the IDE
or at Runtime. It also depends on what "timer" you are using: The
Timer control? Something from the WinAPI? Multimedia Timer? ...

But you know all this, so what are you 'really' asking?

-ralph
0
ralph
9/5/2010 7:01:53 PM
On Sun, 05 Sep 2010 14:01:53 -0500, ralph <nt_consulting64@yahoo.net>
wrote:
  
>>I'm putting a timer on the main form of my utility.  Are there any
>>quirks I should know about?
>>
>>I ask because there is an interesting quirk with the timer event in
>>Access that developers need to know about.
>>
>
>Ha, yes there are many "quirks" with a timer.
>
>Most deal with whether a timer will fire or not (blocked) in the IDE
>or at Runtime. It also depends on what "timer" you are using: The
>Timer control? Something from the WinAPI? Multimedia Timer? ...

Sorry, the timer control.  It seems to be working so far in the IDE
and not causing any troubles, yet, with the Glow Button sublassing.

>But you know all this, so what are you 'really' asking?

No, I don't know the quirks with the Timer control in VB6.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
0
Tony
9/5/2010 7:08:37 PM
On Sun, 05 Sep 2010 13:08:37 -0600, Tony Toews
<ttoews@telusplanet.net> wrote:


>
>Sorry, the timer control.  It seems to be working so far in the IDE
>and not causing any troubles, yet, with the Glow Button sublassing.
>
>>But you know all this, so what are you 'really' asking?
>
>No, I don't know the quirks with the Timer control in VB6.
>

I'm so used to seeing your name, just assumed you were a long-time
VBer, so actually that was a complement, not a derision or jeer. <g>

Any quirks will be related to using a control vs. the API (including
the WinAPI, or any other API), handling Events in general, and whether
you are using more than one.

As for the Timer control, it is not very precise. (Well actually
neither is the WinAPI, though at a slightly better level of
precision.) So depending on your interveral, it may or may not meet
your requirements.

For example: While the Timer control lets you set any interval from
"1" on ... in fact the best it can ever do is 55ms. Plus consider the
Event is queued - so it also depends on someone being able to act when
it does go off.

WinAPI timers in theory can do better, 12-60ms (depending on the O/S)
and IIRC the hardware. Sounds better but note it actually delivers a
'range' of possiblities - so you may be more 'precise' but less
accurate over-all.

For events in general - Kevin posted this a while back in response to
a WithEvents question.
http://vb.mvps.org/samples/SyncEvts/
It is worth a look. Particularily the article where he provides a
little chart rating performance and pointing out where events might
get blocked.

If you are using more than one - I always offer this truism from the
18th century - Never go to sea with two clocks. Take one or Three,
never two. <g>

That should help you be prepared for any 'quirks' that may appear.

-ralph
0
ralph
9/5/2010 8:47:28 PM
"ralph" <nt_consulting64@yahoo.net> wrote in message 
news:gfu7861s7qi1p4ag7vu7r8ps6rkq2vgrf2@4ax.com...
: On Sun, 05 Sep 2010 13:08:37 -0600, Tony Toews
: <ttoews@telusplanet.net> wrote:
:
: I'm so used to seeing your name, just assumed you were a long-time
: VBer, so actually that was a complement, not a derision or jeer. <g>

He's a long time Accesser who finally putting that VBA to the use for which 
it was intended.  <g> 

0
Kevin
9/5/2010 11:47:17 PM
"Tony Toews" <ttoews@telusplanet.net> wrote in message 
news:3hp786t0m7lmiprbnvfeo84n79g20h80qo@4ax.com...
: Folks
:
: I'm putting a timer on the main form of my utility.  Are there any
: quirks I should know about?
:
: I ask because there is an interesting quirk with the timer event in
: Access that developers need to know about.

In general, it's not the most efficent utility if timing is of the essence 
(as ironic as that is).  It all depends on what you are attempting to 
accomplish.  I use timers to fire off events that might come in handy when I 
need something run, but not necessarily in the thread of execution (a poor 
mans phony multi-thread solution).

What are you using your timer for?  I thought I saw something about a glow 
button (we can have the talk about bad UI choices later).  If you are using 
a timer to trip the glow, then don't.  Use TrackMouseEvent. 

0
Kevin
9/6/2010 12:03:10 AM
On Sun, 05 Sep 2010 15:47:28 -0500, ralph <nt_consulting64@yahoo.net>
wrote:
  
>>Sorry, the timer control.  It seems to be working so far in the IDE
>>and not causing any troubles, yet, with the Glow Button sublassing.
>>
>>>But you know all this, so what are you 'really' asking?
>>
>>No, I don't know the quirks with the Timer control in VB6.
>
>I'm so used to seeing your name, just assumed you were a long-time
>VBer, so actually that was a complement, not a derision or jeer. <g>

Thanks.   I was thinking later I should've replied that I've been
working with Access for 15+ years but dabbling in VB6 for the last 10
years.  I've only gotten serious with VB6 this last year.

>Any quirks will be related to using a control vs. the API (including
>the WinAPI, or any other API), handling Events in general, and whether
>you are using more than one.

I have one event firing every 60 seconds which sends a query to an
Access MDB file. It should return usually 0 records but sometimes a
few records such as 1, 2, 5 or 20 records.     If non zero I "turn a
graphic red" on the form.

 The timer control seems to be doing all that I need it to do.

>For events in general - Kevin posted this a while back in response to
>a WithEvents question.
>http://vb.mvps.org/samples/SyncEvts/
>It is worth a look. Particularily the article where he provides a
>little chart rating performance and pointing out where events might
>get blocked.

Hmm, service unavailable.  Karl, Karl!!!  He likely won't read this
until Tuesday but that's fine.

>If you are using more than one - I always offer this truism from the
>18th century - Never go to sea with two clocks. Take one or Three,
>never two. <g>

Hehehe

>That should help you be prepared for any 'quirks' that may appear.

Ok, if those are all the known quirks then I'm happy.

Thanks, Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
0
Tony
9/6/2010 12:05:14 AM
In the VB IDE, Timer events will NOT fire in the presence of modal or 
MsgBoxes. In the EXE, they do. I am not sure about Access, perhaps in Access 
Timer events don't fire when a MsgBox is shown because in Access you are 
always running in the IDE.

PRB: Events Occur in EXE While a Message Box Is Displayed
http://support.microsoft.com/kb/178078



0
Nobody
9/6/2010 2:28:13 AM
On Sun, 5 Sep 2010 19:47:17 -0400, "Kevin Provance" <k@p.c> wrote:
  
>: I'm so used to seeing your name, just assumed you were a long-time
>: VBer, so actually that was a complement, not a derision or jeer. <g>
>
>He's a long time Accesser who finally putting that VBA to the use for which 
>it was intended.  <g> 

HAHAHAHAHA

Good one!

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
0
Tony
9/6/2010 3:50:54 AM
On Sun, 5 Sep 2010 20:03:10 -0400, "Kevin Provance" <k@p.c> wrote:
  
>What are you using your timer for?  

Not at all.  I just want to check a log database every minute to see
if there are any uacknowledged records in the errors table.   

>I thought I saw something about a glow 
>button (we can have the talk about bad UI choices later). 

What about bad UI choices?  Note that you can see what I've got so far
at http://www.autofeupdater.com/   Note the greatest of buttons but
they'll do for what I need.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
0
Tony
9/6/2010 3:53:35 AM
On Sun, 5 Sep 2010 22:28:13 -0400, "Nobody" <nobody@nobody.com> wrote:
  
>In the VB IDE, Timer events will NOT fire in the presence of modal or 
>MsgBoxes. In the EXE, they do.

Ah, ok.  No problem either way then.  I also have the database reads
happening in the form Activate event so that is covered when the modal
form or msg box is responded too.

> I am not sure about Access, perhaps in Access 
>Timer events don't fire when a MsgBox is shown because in Access you are 
>always running in the IDE.

No idea as to if that quirk exists in Access.

What we did find in Access is if the dev has an open form with a timer
running and they're in the VBA editor the Intellisense code would
automatically complete when the timer hit.  Rather annoying if
frequent enough.   Very puzzling if not very frequent.

This would never happen in VB of course.

Tony
-- 
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files 
  updated see http://www.autofeupdater.com/
0
Tony
9/6/2010 3:56:41 AM
Tony Toews wrote:
> Folks
>
> I'm putting a timer on the main form of my utility.  Are there any
> quirks I should know about?
>
> I ask because there is an interesting quirk with the timer event in
> Access that developers need to know about.
>

One superstition many VBers (including me) practice is putting
Timer1.Enabled = False
in the Form_Unload event.
0
Jason
9/6/2010 3:00:21 PM
"ralph" <nt_consulting64@yahoo.net> wrote in message 
news:gfu7861s7qi1p4ag7vu7r8ps6rkq2vgrf2@4ax.com...
> On Sun, 05 Sep 2010 13:08:37 -0600, Tony Toews

> For example: While the Timer control lets you set any
> interval from "1" on ... in fact the best it can ever do
> is 55ms.

That was in Win 98. Its actually typically about 16 milliseconds in XP, 
Vista etc.

Mike



0
Mike
9/6/2010 3:48:04 PM
On Mon, 6 Sep 2010 16:48:04 +0100, "Mike Williams"
<Mike@WhiskyAndCoke.com> wrote:

>"ralph" <nt_consulting64@yahoo.net> wrote in message 
>news:gfu7861s7qi1p4ag7vu7r8ps6rkq2vgrf2@4ax.com...
>> On Sun, 05 Sep 2010 13:08:37 -0600, Tony Toews
>
>> For example: While the Timer control lets you set any
>> interval from "1" on ... in fact the best it can ever do
>> is 55ms.
>
>That was in Win 98. Its actually typically about 16 milliseconds in XP, 
>Vista etc.
>

Thanks for that correction.

-ralph
0
ralph
9/6/2010 5:41:47 PM
Jason Keats wrote:
> Tony Toews wrote:
>> Folks
>>
>> I'm putting a timer on the main form of my utility.  Are there any
>> quirks I should know about?
>>
>> I ask because there is an interesting quirk with the timer event in
>> Access that developers need to know about.
>>
>
> One superstition many VBers (including me) practice is putting
> Timer1.Enabled = False in the Form_Unload event.

Surely you put it in _QueryUnload?

And you call yourself superstitious (-:

-- 
   Jim Mack
   Twisted tees at http://www.cafepress.com/2050inc
   "We sew confusion"

0
Jim
9/6/2010 5:51:22 PM
Jim Mack wrote:
> Jason Keats wrote:
>> Tony Toews wrote:
>>> Folks
>>>
>>> I'm putting a timer on the main form of my utility.  Are there any
>>> quirks I should know about?
>>>
>>> I ask because there is an interesting quirk with the timer event in
>>> Access that developers need to know about.
>>>
>>
>> One superstition many VBers (including me) practice is putting
>> Timer1.Enabled = False in the Form_Unload event.
>
> Surely you put it in _QueryUnload?
>
> And you call yourself superstitious (-:
>

Well, it has worked for me (knock on wood). So, I'd better keep doing it 
my way (fingers crossed). :-)
0
Jason
9/6/2010 9:10:24 PM
Tony Toews has brought this to us :
>> For events in general - Kevin posted this a while back in response to
>> a WithEvents question.
>> http://vb.mvps.org/samples/SyncEvts/
>> It is worth a look. Particularily the article where he provides a
>> little chart rating performance and pointing out where events might
>> get blocked.
>
> Hmm, service unavailable.  Karl, Karl!!! 

That server does an internal reset every couple hours.  Usually takes 
1-2 minutes, max.  Wish I had a better answer to a highly persistent 
memory leak, but for now that's it.  :-(

> He likely won't read this
> until Tuesday but that's fine.

You know me way too well! <g>

-- 
..NET: It's About Trust!
http://vfred.mvps.org


0
Karl
9/7/2010 8:15:00 PM
Reply:

Similar Artilces:

Any "quirsk" with the timer control
Folks I'm putting a timer on the main form of my utility. Are there any quirks I should know about? I ask because there is an interesting quirk with the timer event in Access that developers need to know about. Tony -- Tony Toews, Microsoft Access MVP Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ For a convenient utility to keep your users FEs and other files updated see http://www.autofeupdater.com/ On Sun, 05 Sep 2010 12:51:33 -0600, Tony Toews <ttoews@telusplanet.net&...