Form_Timer alternative Access 2003

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adrian Biljan

    #1

    Form_Timer alternative Access 2003

    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(Time rInterval 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
  • Stephen Lebans

    #2
    Re: Form_Timer alternative Access 2003

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

    --

    HTH
    Stephen Lebans

    Access Code, Tips and Tricks
    Please respond only to the newsgroups so everyone can benefit.


    "Adrian Biljan" <abiljan@gmail. com> wrote in message
    news:6ecf88c4.0 504221341.c2b15 c6@posting.goog le.com...[color=blue]
    > 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(Time rInterval 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[/color]

    Comment

    • adrian biljan

      #3
      Re: Form_Timer alternative Access 2003

      Thanks for the response.

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

      Thanks,

      Adrian


      *** Sent via Developersdex http://www.developersdex.com ***

      Comment

      Working...