ActiveX Timer Control IN VBA

R

Rhonda

In Access 2002
Should I be able to use the activex timer control in vba as I do in vb6?

This is my test form:

Private Sub Timer4_Timer()
Me!Timer4.Enabled = False
bEndTimer4 = True
End Sub

Private Sub cmdTimerTest_Click()
Me!frmTime_Test.Timer4.Interval = 2000
bEndTimer4 = False
Me!frmTime_Test.Timer4.Enabled = True
Do
DoEvents
Sleep 5
LogItem$ = "Timer now timing"
Forms!frmTimer_Test.List46.AddItem LogItem$
Loop Until bEndTimer4
End Sub

It never reaches the interval. What might I be doing wrong?
 
D

Damian S

Hi Rhonda,

Why are you using the activex timer control? Forms have an On Timer event
built in. Set the timer interval and then do something in the On Timer
event. When you want to switch teh form's timer off, set the TimerInterval
to 0.

Hope this helps.

Damian.
 
R

Rhonda

Ok

So you are implying the syntax and usage of the Access form timer is exactly
the same as the ActiveX control then?

The Form_Timer won't accept the Interval using the below syntax...

If you want to steer me away from something I'm familiar with, I'll need
more...
 
S

storrboy

In Access 2002
Should I be able to use the activex timer control in vba as I do in vb6?

This is my test form:

Private Sub Timer4_Timer()
Me!Timer4.Enabled = False
bEndTimer4 = True
End Sub

Private Sub cmdTimerTest_Click()
Me!frmTime_Test.Timer4.Interval = 2000
bEndTimer4 = False
Me!frmTime_Test.Timer4.Enabled = True
Do
DoEvents
Sleep 5
LogItem$ = "Timer now timing"
Forms!frmTimer_Test.List46.AddItem LogItem$
Loop Until bEndTimer4
End Sub

It never reaches the interval. What might I be doing wrong?


Forms have "built-in" timers and a timer event to go with them. They
can be found on the Even tab of the forms property sheets.

On Timer and Timer Interval
 
S

Storrboy

Rhonda said:
Ok

So you are implying the syntax and usage of the Access form timer is exactly
the same as the ActiveX control then?

The Form_Timer won't accept the Interval using the below syntax...

If you want to steer me away from something I'm familiar with, I'll need
more...


If you're not familiar with a tool, shouldn't you learn about it before
using it? Or would you try to assemble a bookshelf with an impact driver?
Each post I've seen from you starts with asking why some classic VB code
does not work. Access is not classic VB. The share the core of the language,
not all of it.


Private Sub Form_Timer()
Dim a As Integer
Do Until a = 10 'Run 10 times then stop
Debug.Print "Timer Occured On " & Time
a = a + 1
Loop
Me.TimerInterval = 0
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top