If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Prevent OnTimer
I have setup an OnTimer event on one of my forms. One of the first things
it does is check to see if the db is configured to run the "automatic check". It does this by checking a flag in the database. If it is configured to run this check, it will run the procedure. If it is not configured it will exit the procedure. Given this db is going to be up all day, after the OnTimer Event time interval is reached, the system is constantly going to be attempting to run this procedure. Which leads me to my question...is it possible to prevent the system from even going to the OnTimer Event if a flag in the db is configured not to run OnTimer Event? I would rather save events from firing off if they are unnecessary. Below is the code I am using: Private Sub Form_Timer() Dim sWorkOrderStatusWarningTurnOn As String sWorkOrderStatusWarningTurnOn = DLookup("[ParameterValue]", "sys_SystemParameters", "[ParameterID] = " & 4) 'Means the user has turned on the functionality If (sWorkOrderStatusWarningTurnOn = 1) Then RemindUser End If End Sub |
#2
|
|||
|
|||
Prevent OnTimer
Hi scadav,
The way to prevent On Timer events from firing is to set the Timer Interval to 0, so on the Open Form event you might like to have something like this: Dim sWorkOrderStatusWarningTurnOn As String sWorkOrderStatusWarningTurnOn = DLookup("[ParameterValue]", "sys_SystemParameters", "[ParameterID] = " & 4) 'Means the user has turned on the functionality If (sWorkOrderStatusWarningTurnOn = 1) Then me.timerInterval = 1000 else ' No timer events me.timerinterval = 0 End If Then, simply have your timer event call RemindUser, as it will only fire if the flag is set. Damian. "scadav" wrote: I have setup an OnTimer event on one of my forms. One of the first things it does is check to see if the db is configured to run the "automatic check". It does this by checking a flag in the database. If it is configured to run this check, it will run the procedure. If it is not configured it will exit the procedure. Given this db is going to be up all day, after the OnTimer Event time interval is reached, the system is constantly going to be attempting to run this procedure. Which leads me to my question...is it possible to prevent the system from even going to the OnTimer Event if a flag in the db is configured not to run OnTimer Event? I would rather save events from firing off if they are unnecessary. Below is the code I am using: Private Sub Form_Timer() Dim sWorkOrderStatusWarningTurnOn As String sWorkOrderStatusWarningTurnOn = DLookup("[ParameterValue]", "sys_SystemParameters", "[ParameterID] = " & 4) 'Means the user has turned on the functionality If (sWorkOrderStatusWarningTurnOn = 1) Then RemindUser End If End Sub |
#3
|
|||
|
|||
Prevent OnTimer
On Mar 6, 6:31 pm, Damian S wrote:
Hi scadav, The way to prevent On Timer events from firing is to set the Timer Interval to 0, so on the Open Form event you might like to have something like this: Dim sWorkOrderStatusWarningTurnOn As String sWorkOrderStatusWarningTurnOn = DLookup("[ParameterValue]", "sys_SystemParameters", "[ParameterID] = " & 4) 'Means the user has turned on the functionality If (sWorkOrderStatusWarningTurnOn = 1) Then me.timerInterval = 1000 else ' No timer events me.timerinterval = 0 End If Then, simply have your timer event call RemindUser, as it will only fire if the flag is set. Damian. "scadav" wrote: I have setup an OnTimer event on one of my forms. One of the first things it does is check to see if the db is configured to run the "automatic check". It does this by checking a flag in the database. If it is configured to run this check, it will run the procedure. If it is not configured it will exit the procedure. Given this db is going to be up all day, after the OnTimer Event time interval is reached, the system is constantly going to be attempting to run this procedure. Which leads me to my question...is it possible to prevent the system from even going to the OnTimer Event if a flag in the db is configured not to run OnTimer Event? I would rather save events from firing off if they are unnecessary. Below is the code I am using: Private Sub Form_Timer() Dim sWorkOrderStatusWarningTurnOn As String sWorkOrderStatusWarningTurnOn = DLookup("[ParameterValue]", "sys_SystemParameters", "[ParameterID] = " & 4) 'Means the user has turned on the functionality If (sWorkOrderStatusWarningTurnOn = 1) Then RemindUser End If End Sub- Hide quoted text - - Show quoted text - Brilliant. Thank you. |
Thread Tools | |
Display Modes | |
|
|