Close form on Idle (1 Viewer)

Pavczech

Registered User.
Local time
Today, 19:40
Joined
Jul 11, 2012
Messages
41
Hello all

Could somebody help me. I need to close the form on idle more than 2 min.
There is 5 text boxes so even if somebody inputs text in one textbox, but doesn't finish the rest of them it will close without saving data.
I have tried timer but it doesn't seems to be working.

Thanks
 

Pavczech

Registered User.
Local time
Today, 19:40
Joined
Jul 11, 2012
Messages
41
It does what I wanted to do, there are some other issues with my forms which are connected to the forms, hope I can figure out that one. Thanks
 

pr2-eugin

Super Moderator
Local time
Today, 19:40
Joined
Nov 30, 2011
Messages
8,494
You are welcome, if you have questions.. post back we will try to help you out..
 

Pavczech

Registered User.
Local time
Today, 19:40
Joined
Jul 11, 2012
Messages
41
Hello

It works as far as setting the idle time, but i have tried to close the form without updating the tables and it is not working.
I tried:
Sub IdleTimeDetected(ExpiredMinutes)
Docmd.close,acsaveno
cancel=true
End Sub

Any help, please!
Thanks
 

pr2-eugin

Super Moderator
Local time
Today, 19:40
Joined
Nov 30, 2011
Messages
8,494
If you want to cancel an Update to Table via the Form it should be in the Form_BeforeUpdate event..
 

Pavczech

Registered User.
Local time
Today, 19:40
Joined
Jul 11, 2012
Messages
41
Hi ya.
Yep I alredy have on the form beforeupdate code which checks if the record exist.
If it does than it cancel the input in to the table and opens another form, if the record doesn't exist it inputs it in to the table and open another form.
The problem is there are 3 compolsury fields which they need to be entered. What I would like to do if the idle time runs out and those fields are empty than do not enter the records in to the tables.
I hope it makes sence.
Thanks very much
 

pr2-eugin

Super Moderator
Local time
Today, 19:40
Joined
Nov 30, 2011
Messages
8,494
You can still make the checks in the FormUpdate property.. When the method Sub IdleTimeDetected(ExpiredMinutes), is called set a flag as true.. Then use that Flag to test..
Code:
Sub IdleTimeDetected(ExpiredMinutes)
    canxIdle = True
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer) 
    If canxIdle Then Cancel = True
End Sub
 

Users who are viewing this thread

Top Bottom