Can not get form Timmer to work

itmasterw

Registered User.
Local time
Today, 01:56
Joined
Oct 31, 2005
Messages
45
Hi,
I am using MS Access 2010.
I looked up how to set a timer. I want to set a timer for form inactivity, but before it even gets to my code it comes up with
that Form_Timer() function is not define.
what so I have to do to define this?
Thank you

My code:
Code:
Private Sub Form_Timer()
If Forms!frmMain!ynActive Then
   Forms!frmMain!ynActive = False
Esle
   DoCmd.Close acForm, frmMain, acSaveNo
End If
 
Did you Copy and Paste this code from your Form? It would not compile if you did.
 
Click on the ellipsis in the On Timer event property. Then click on Code Builder in the Choose Builder dialog. It will either create a legitimate function or take you to the one your already have.



attachment.php
 

Attachments

  • Timer Function.png
    Timer Function.png
    43.6 KB · Views: 238
Last edited:
Sorry, I am not sure what you mean here. To make this simple this all in the same form. Eventually, I am going to put this on other forms. Are you saying that this code has to be in another form?
Thank you
 
Timer interval MUST have a value....not zero.
 
I have a check box on the form and the idea is that if I do nothing the form will close, but if I click on the form it will set the check box to true and will not close the form. What I am looking to do is lets say a user in my application has one of four forms open, I and does noting I want to close the application, if they click on some thing then I want to leave it open. I am starting with this simple example to get this to work first.
Thank you
 
Are you saying that this code has to be in another form?
Thank you
I don't think anyone meant that. A timer event can close the form it's in. Edit: or quit the application (DoCmd.Quit)

You may know this but you will need some code to reset the timer value. You will probably want to reset it based on key press and click events.
 
Everything else aside, such as how ynActive gets set, other than thru this code

Code:
Private Sub Form_Timer()
If Forms!frmMain!ynActive Then
   Forms!frmMain!ynActive = False
[COLOR="Red"]Esle[/COLOR]
   DoCmd.Close acForm, frmMain, acSaveNo
End If
the typo in red will keep your code from compiling/working!

Do you, in fact, have the Timer Interval set?

Linq ;0)>
 
No, and I even tried this in another form. I have the Me.TimerInterval = 10000 set and it still comes back with Timer not defined??
 
Yes that was it thanks. I cannot believe that I did not see it.
Thank you
 

Users who are viewing this thread

Back
Top Bottom