Timer event failing sporadically -- Office 2007 VBA

T

Tech_vs_Life

After installing Office 2007 on 32-bit Vista Ultimate, the VBA timer event
periodically fails to fire (I'm using VBA in Microsoft Access).

So far, it fails about once a day, but once it fails, it fails several times
in a row. (The interval is set every 15000 millliseconds).

Any suggestions as to what could be the cause, or how to test it?

Thanks.
 
T

Tech_vs_Life

I still haven't discovered a solution to this. I have turned off almost
every superfluous service (e.g. Windows Defender), but the VBA timer event
still fails to fire periodically (I have it set to fire every 13 seconds or
so, and every so often it will have a two to four minute or so gap between
firings). This occurs about twice a week in round the clock operation. The
same code had no problem in Windows XP and office 2003.

Anyone have any suggestions?
 
A

Allen Browne

Curious. This could be quite hard to track down, as there could be so many
factors to examine.

What is the timer event doing? Presumably you are logging it to a table, so
you can identify the cases where it fails to fire.

Is it possible that the OS is tied up at the times when it fails, and so is
not giving CPU processor time to the Access appllication? For example, if
you copy/delete a large number of files in Vista, it can take a long time to
complete the operation, and if Access is a background application, it is not
getting any processing time for a few minutes?

Perhaps someone with a better understanding of how Vista manages resources
could comment on whether this line is worth investigating.
 
T

Tech_vs_Life

Thanks for your help. As you say, this is one of those issues one despairs
of ever resolving because of all the variables.

I'm doing a debug.print (prints to a window in VBA). I've tracked where the
VB code is at every step, and it's doing nothing at all at the time the
Timer Event should fire.

The timer event (which is supposed to fire every 15 seconds) has been
reduced to this:
Debug.Print "before:" & Now()
If Minute(now) = 4 Then DoSomeX 'DoSomeX just does some more logging
Debug.Print "after: " & Now()

The debug window shows that the timer "forgets" to fire for a few minutes at
a time, randomly about twice a week, but only AFTER printing "after:"--so
it's not that some code in DoSomeX is preventing the timer event from
firing. Yes, there could be other things Vista is doing that prevents the
timer from firing, but I find that doubtful. First, at the list of times it
fails I've seen no CPU activity or disk activity, and no events in the event
viewer. Second, I've shutdown practically every Vista service that could be
shutdown (including disk defragmenter, the Windows Defender, System Restore,
Firewall, windows Search/indexer, and basically everything except basic
networking). I don't have antivirus on this system, which is usually a
culprit in mystery behavior (and no viruses on this system either).

Is there some alternative api code that I should use to get to the Windows
timer or system clock directly from within VBA (using a declare)? I suppose
I'd need callbacks to do that--but I need to get this to work. The
identical vba code worked flawlessly in Windows XP and office 2003, on the
same hardware. it could be that a bug has been introduced when vba Timers
are left running continuously for a long time, but it could be something
else entirely.
 
A

Allen Browne

I'm not sure what else to suggest.

If anyone else has gems of wisdom, please feel invited to post them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top