• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 428
  • Last Modified:

MS Access Macro Execution on Forms Timer

I have an Access database (2000 version) running on my plant floor which rotates a series of form displays.  The rotation of the open / close of the forms is controlled by a macro that executes every 10 seconds using the timer event property on forms.  Occassionally, the macro failes to execute resulting in the display showing a "HALT" message.  This is rare...i can count on one hand how many times the rotation has stoped (since November 2010 when we deployed the application) and as a result, I am unalbe to determine why the error is occuring.  Any thoughts?  The only way to fix the HALT error is to close and reopen the database.  The DB is split, with 5 copies of front ends running on PC's linked to back end tables which resides on our local server / share, but only one PC services the 4 monitor / displays running the rotation sequence.  Thanks.
0
t87994
Asked:
t87994
  • 4
  • 3
  • 2
  • +1
1 Solution
 
conagramanCommented:
wow.. that could be anything.

your right if it happened before it will happen again- maybe put an error handler in to try and catch the error if it ever happens again.
0
 
Nick67Commented:
The timer is a funny monster.
It ONLY runs when the app is active and the form is the active form.

Windows update notifier?
Outlook task?
Java update
Acrobat update.

The HALT is something that I run into when I open a db on one machine that has it's references in different spots than another, or different Access versions.
Generally, you compile on the dev machine and push out the front ends.

What happens if you try to compile the code in the VBA|debug|compile option on each of the machines?
Does it compile on them all?
You may have to change a tiny bit of code to permit a compile to be done.
If not, then your app is very infrequently running a bit of code that won't work on that particular machine
0
 
t87994Author Commented:
Maybe i should convert the macro that handles the form open/close routine to vba...?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Nick67Commented:
Maybe.
Can you post the macro?
0
 
Jeffrey CoachmanCommented:
Yes, this sounds like a "Timing" (no pun intended) error.

The Timer itself is not perfect, and is a bit of a resource hog.
As such, it can get tripped up by other applications that are a resource intensive.
(Antivirus, Web Browser, system functions,...etc)

This is yet another reason to move away from Macros and use VBA.
VBA has much more robust error handling and debugging tools.

So, yes, please post the macro.

JeffCoachman
0
 
t87994Author Commented:
Thanks Jeff.  As we've progressed with the development of this great system, we've seen the benefit to VBA vs. a bunch of macros.  This is definately a to do.  The Macro converted seems simple enough.  Interested in your thoughts.  Thanks again.  Here is the Macro code:

'------------------------------------------------------------
' mcrOnTimerCountDaysAV
'
'------------------------------------------------------------
Function mcrOnTimerCountDaysAV()
On Error GoTo mcrOnTimerCountDaysAV_Err

    DoCmd.Close acForm, "frmPressGroupOutputDaysMonitorAV1"
    DoCmd.OpenForm "frmPressStatusMonitor1AV", acNormal, "", "", acReadOnly, acNormal
    Exit Function


mcrOnTimerCountDaysAV_Exit:
    Exit Function

mcrOnTimerCountDaysAV_Err:
    MsgBox Error$
    Resume mcrOnTimerCountDaysAV_Exit

End Function
0
 
Jeffrey CoachmanCommented:
< The Macro converted seems simple enough.>
Now all you have to do move this code to the OnTimer event and make sure the Timer interval is set to 10 minutes (600000)

...so the final code should look something *roughly* like this:

Sub Form_Timer()

On Error GoTo Form_Timer_Err
    DoCmd.Close acForm, "frmPressGroupOutputDaysMonitorAV1"
    DoCmd.OpenForm "frmPressStatusMonitor1AV", acNormal, "", "", acReadOnly, acNormal
Form_Timer_Exit
    Exit sub
Form_Timer_Err
    MsgBox Error$
    Resume mcrOnTimerCountDaysAV_Exit

End Sub
0
 
t87994Author Commented:
I will convert all timer event routines to VBA and keep an eye out for the issue.  PC / network updates may be the cause of the issue, as these occur at rarely scheduled intervals over the network when necessary and since we just leave the Db running constantly, even over the weekends, the updates may interfere somehow with the timer events.  Thanks for your help.
0
 
t87994Author Commented:
Still unknown factors; however, using VBA vs. macro will allow flexibiility for better error handling explanations.
0
 
Jeffrey CoachmanCommented:
<macro will allow flexibiility for better error handling explanations.>
No, if you want *True* flexibility for error handling explanations, you must use VBA (not Macros).
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now