timer

I am reading from an access database, i need a timer to triger this reading every 15 minutes, 30,45, and 60 minutes. I have not used timers before so please suggest anything

thanks
sml41Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
Add a timer to your program and put this in the timer event:

    Select Case Val(Format(Now, "n"))
        Case 0, 15, 30, 45
            'YOUR EVENT GOES HERE
    End Select

set the timer interval property to 1000
and enable it...

Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mcriderCommented:
The example I gave you wil kick off the timer once a second, looking to see if the system clock is at one of the quarter hours...  You can increase to timer intercal property to 60000 and it will check once a minute...



Cheers!
0
danlevansCommented:
With an interval of 1000 would you not execute up to60 times for each of the cases?

With a setting of 60000 you might miss depending on timing.

You are limited to 65000 as the max setting so this causes a problem. Most set up a public counter and with a setting of 60000 you count the counter until it gets to 15.

I would be interested in a slick way to do this.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

mcriderCommented:
danlevans,

sml41 is looking to fire an event at the quarter hours. Even at setting the timer to 60000 you will not miss the event, because the code looks at the system clock's minute value...

Cheers!
0
danlevansCommented:
mcrider

I see what he wants. What you give him is something different. With timer at 1000 it will fire 60 times in one minute. It will find the clock at 15 minutes 60 times!

Now at 60000 if the event fires 60000 one millisecond before 15 goes to 16 you will probably miss it.

Cheers!!
0
mcriderCommented:
I was assuming that sml41 would know how to stop an event from firing multiple times... Ok...

using the original code, add a second timer and disable it. then in timer1 Event, do the following:
 
   Select Case Val(Format(Now, "n"))
        Case 0, 15, 30, 45
            Timer1.Enabled = False
            '
            'YOUR EVENT GOES HERE
            '
            With Timer2
                 .Interval = 65535
                 .Enabled = True
            End With
    End Select

And in Timer2's Event:

   Timer2.Enabled = False
   Timer1.Enabled = True


Cheers!
0
sonalchouhanCommented:
well i want that the i want the beep after every 30 minutes from the time form is loaded

thanks
sonal
0
sml41Author Commented:
thank all
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.