By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,576 Members | 1,399 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,576 IT Pros & Developers. It's quick & easy.

Mutliple timers on one form

P: n/a
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.TimerInterval Then
ArchiveTimer = ArchiveTimer
Else
ArchiveTimer = Me.TimerInterval
End If
ArchiveTimer = ArchiveTimer + Me.TimerInterval

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
Nov 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi All,
I managed to solve my problem by using Static instead of Dim.

Thanks anyway,

Mark
"Mark" <ma*********@ntlworld.com> wrote in message
news:Q9**************@newsfe5-win.ntli.net...
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.TimerInterval Then
ArchiveTimer = ArchiveTimer
Else
ArchiveTimer = Me.TimerInterval
End If
ArchiveTimer = ArchiveTimer + Me.TimerInterval

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

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.