Mutliple timers on one form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    #1

    Mutliple timers on one form

    All,
    My VBA experience is very limited so please bear with me. I have a main
    form which I want to add several timer events to but they need to fire at
    different intervals. One say every 5 minutes and one every 30 minutes. I
    know I could put several invisible unbound text boxes on the form and update
    their values with the forms one timer event and then check the value of each
    text box but I am trying to improve my VBA skills.

    Is there a way in which I could store and update several variables to
    memory? I have tried the following code but the ArchiveTimber value is reset
    to zero once the code runs again rather than being incremented by the timer
    interval.

    Dim ArchiveTimer As Single

    If ArchiveTimer > Me.TimerInterva l Then
    ArchiveTimer = ArchiveTimer
    Else
    ArchiveTimer = Me.TimerInterva l
    End If


    ArchiveTimer = ArchiveTimer + Me.TimerInterva l

    Debug.Print ArchiveTimer

    Exit Sub

    I'm obviously missing something here so I was hoping someone could point me
    in the right direction.

    TIA,

    Mark


  • Mark

    #2
    Re: Mutliple timers on one form

    Hi All,
    I managed to solve my problem by using Static instead of Dim.

    Thanks anyway,

    Mark


    "Mark" <mark.reed75@nt lworld.com> wrote in message
    news:Q9Vgf.144$ a15.85@newsfe5-win.ntli.net...[color=blue]
    > All,
    > My VBA experience is very limited so please bear with me. I have a main
    > form which I want to add several timer events to but they need to fire at
    > different intervals. One say every 5 minutes and one every 30 minutes. I
    > know I could put several invisible unbound text boxes on the form and
    > update their values with the forms one timer event and then check the
    > value of each text box but I am trying to improve my VBA skills.
    >
    > Is there a way in which I could store and update several variables to
    > memory? I have tried the following code but the ArchiveTimber value is
    > reset to zero once the code runs again rather than being incremented by
    > the timer interval.
    >
    > Dim ArchiveTimer As Single
    >
    > If ArchiveTimer > Me.TimerInterva l Then
    > ArchiveTimer = ArchiveTimer
    > Else
    > ArchiveTimer = Me.TimerInterva l
    > End If
    >
    >
    > ArchiveTimer = ArchiveTimer + Me.TimerInterva l
    >
    > Debug.Print ArchiveTimer
    >
    > Exit Sub
    >
    > I'm obviously missing something here so I was hoping someone could point
    > me in the right direction.
    >
    > TIA,
    >
    > Mark
    >[/color]


    Comment

    Working...