473,544 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Nov 23 '05 #1
1 1387
Hi All,
I managed to solve my problem by using Static instead of Dim.

Thanks anyway,

Mark
"Mark" <ma*********@nt lworld.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.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

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2183
by: Nathan Kovac | last post by:
I have a feeling I am missing something simple, but I just can't find it. Perhaps someone can give me a lead on where to look. I will describe the issue then post my code to the web service. My issue is simply getting timers to work. I have a DatabaseManager.DataManagerFacade which contains a timer. Every 6 seconds it updates stock data...
10
2677
by: WhiteSocksGuy | last post by:
Help! I am new to Visual Basic .Net (version 2002) and I am trying to get a System.Timers.Timer to work for me to display a splash screen for about two seconds and then load the main form. I have two forms (frmSplash and frmMain) and a code Module setup as my startup object. Here is the code that I have, when I try to run this part of the...
5
9862
by: Michael C# | last post by:
Hi all, I set up a System.Timers.Time in my app. The code basically just updates the screen, but since the processing performed is so CPU-intensive, I wanted to make sure it gets updated regularly; like every 1.5 secs. or so. I only ran into one issue - the MyTimer_Elapsed event handler was not updating the screen correctly all the time,...
9
1350
by: N! Xau | last post by:
hi I need a way to threat a certain number of timers in a homogeneous way. Let's say I have this code: select X case 1 timer1.enabled = true case 2
8
3164
by: Jerry Spence1 | last post by:
I am trying to create timers on demand by doing the following: Dim NewTimer As New System.Timers.Timer NewTimer.Interval = 10000 AddHandler NewTimer.Elapsed, AddressOf Timeup NewTimer.Enabled = True NewTimer.Start() My problem then happens in the TimeUp routine
3
354
by: Maarten | last post by:
Hi In my aplication it seems that my timer slows down everything, is there a better and/or diferent way than using a timer Maarten
4
1397
by: Dave | last post by:
MS Virtual Server 2005 (not R2) with .Net 2003 I created a Console App and A windows form both with Timers in it. For the console i used system.timers and the windows form i used system.windows.forms.timers. Now for the problem, with both Apps the timers will stop for no reason. I mean the logic in the timer events is simply timer.enable...
4
11093
by: Liverpool fan | last post by:
I have a windows application written using VB .NET that encompasses a countdown timer modal dialog. The timer is a System.Timers.Timer with an interval of 1 second. AutoReset is not set so accepts the default of True. The Elapsed event handler updates the dialog box with how long before it will close, acting as a timer itself. The dialog has a...
2
2012
by: whitethomas12 | last post by:
Hi, I currently have some basic code that allows me to run the tracert command through VB.NET and it also updates my database based on the results. I was wondering if someone can help me find a way that I can used my code to run tracert on mutiple instances at the same time. The following is my current code.
0
7642
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7796
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7405
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7737
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5950
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5316
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3432
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.