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

Form_Timer alternative Access 2003

P: n/a
Hey all,

I'm trying to create a timer class so I can control when the timer
start and stops. The ideas is to have a form with a start button, and
a stop button.
Start invokes a class method that polls a linked table's data through
a SQL stored procedure.
Stop just stops the process from running.

My issue is the Form_Timer isn't robust enough.
I've tried using the following:

Public Declare Function SetTimer Lib "user32" (ByVal HWnd As Long, _
ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As
Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal HWnd As Long, _
ByVal nIDEvent As Long) As Long


Public TimerID As Long
Public TimerSeconds As Single
Public Sub StartTimer(TimerInterval As Integer)
TimerSeconds = TimerInterval ' how often to "pop" the timer.
TimerID = SetTimer(0&, 0&, TimerSeconds * 1000&, AddressOf
AlgoProc)
End Sub
Public Sub AlgoProc(ByVal HWnd As Long, ByVal uMsg As Long, ByVal
nIDEvent As _
Long, ByVal dwTimer As Long)
' process code here
End Sub
in a bas module but keep getting an invalid use of Addressof error.

Any help/direction would be appreciated.
Thanks,

Adrian
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Are you sure all of the code is in a standard Code module not in a Class
module?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Adrian Biljan" <ab*****@gmail.com> wrote in message
news:6e*************************@posting.google.co m...
Hey all,

I'm trying to create a timer class so I can control when the timer
start and stops. The ideas is to have a form with a start button, and
a stop button.
Start invokes a class method that polls a linked table's data through
a SQL stored procedure.
Stop just stops the process from running.

My issue is the Form_Timer isn't robust enough.
I've tried using the following:

Public Declare Function SetTimer Lib "user32" (ByVal HWnd As Long, _
ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As
Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal HWnd As Long, _
ByVal nIDEvent As Long) As Long


Public TimerID As Long
Public TimerSeconds As Single
Public Sub StartTimer(TimerInterval As Integer)
TimerSeconds = TimerInterval ' how often to "pop" the timer.
TimerID = SetTimer(0&, 0&, TimerSeconds * 1000&, AddressOf
AlgoProc)
End Sub
Public Sub AlgoProc(ByVal HWnd As Long, ByVal uMsg As Long, ByVal
nIDEvent As _
Long, ByVal dwTimer As Long)
' process code here
End Sub
in a bas module but keep getting an invalid use of Addressof error.

Any help/direction would be appreciated.
Thanks,

Adrian


Nov 13 '05 #2

P: n/a
Thanks for the response.

I've moved the code into a bas module.
Compiling now.

Thanks,

Adrian
*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.