A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Prevent OnTimer



 
 
Thread Tools Display Modes
  #1  
Old March 6th, 2007, 11:00 PM posted to microsoft.public.access.gettingstarted
scadav
external usenet poster
 
Posts: 17
Default 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  
Old March 6th, 2007, 11:31 PM posted to microsoft.public.access.gettingstarted
Damian S
external usenet poster
 
Posts: 741
Default 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  
Old March 6th, 2007, 11:40 PM posted to microsoft.public.access.gettingstarted
scadav
external usenet poster
 
Posts: 4
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.