idle forms

  • Thread starter Thread starter Haggr1 via AccessMonster.com
  • Start date Start date
H

Haggr1 via AccessMonster.com

How do code an idle form (idle for mare than two minutes) to close and open
main form?
 
Thanks, I tried that and that event closes the form even if it is not idle.
This the something to add to that event other than time incrimates?
 
Well, one way to do it would be to have a date/time variable that you fill
each time someone does something on the form. Then the TIMER event could
simply check to see how long it's been between "now" and when the last
"thing" was done on the form. Once a certain interval had elapsed, the timer
event would simply close the form.
 
I think you are on the right track. but I would need help with code. At
form open focus is set to text."job number" then moves to date/ time text box
which default value =Now() then to text.amount then a marco "data entry".

so job number lost focus could start a timer event, daty entry could also.
Please "Show me the code"

Thanks
Well, one way to do it would be to have a date/time variable that you fill
each time someone does something on the form. Then the TIMER event could
simply check to see how long it's been between "now" and when the last
"thing" was done on the form. Once a certain interval had elapsed, the timer
event would simply close the form.
Thanks, I tried that and that event closes the form even if it is not idle.
This the something to add to that event other than time incrimates?
[quoted text clipped - 3 lines]
 
Realistically, ANY event could be used to reset the date/time variable.
Personally, I'd create a PUBLIC date/time var in a Module, then a PUBLIC SUB
in that same module to fill the value. Then I'd simply direct mutiple events
of my choosing on the form, to the PUBLIC SUB. All the ON TIMER event would
do would be to check the difference between NOW and THEN, and if the value
were long enough, the form would close.

From a coding standpoint, there's not much there. The bigger issue is for
you to determine what form/control events (clicking a button or a textbox ON
CHANGE event for example?) would trigger the reset of the public date/time
variable. Everything else would kind-of "auto-run," you know...?


Haggr1 via AccessMonster.com said:
I think you are on the right track. but I would need help with code. At
form open focus is set to text."job number" then moves to date/ time text box
which default value =Now() then to text.amount then a marco "data entry".

so job number lost focus could start a timer event, daty entry could also.
Please "Show me the code"

Thanks
Well, one way to do it would be to have a date/time variable that you fill
each time someone does something on the form. Then the TIMER event could
simply check to see how long it's been between "now" and when the last
"thing" was done on the form. Once a certain interval had elapsed, the timer
event would simply close the form.
Thanks, I tried that and that event closes the form even if it is not idle.
This the something to add to that event other than time incrimates?
[quoted text clipped - 3 lines]
How do code an idle form (idle for mare than two minutes) to close and open
main form?
 
Okay [forms]![table1]![job_number] ("table1" is the name of that form) On
change.
With a two minute time out. Please show me the code. I understand everything
you are saying, but I don't have to VB knowledge to code this. Thanks in
advance sincerely.
Realistically, ANY event could be used to reset the date/time variable.
Personally, I'd create a PUBLIC date/time var in a Module, then a PUBLIC SUB
in that same module to fill the value. Then I'd simply direct mutiple events
of my choosing on the form, to the PUBLIC SUB. All the ON TIMER event would
do would be to check the difference between NOW and THEN, and if the value
were long enough, the form would close.

From a coding standpoint, there's not much there. The bigger issue is for
you to determine what form/control events (clicking a button or a textbox ON
CHANGE event for example?) would trigger the reset of the public date/time
variable. Everything else would kind-of "auto-run," you know...?
I think you are on the right track. but I would need help with code. At
form open focus is set to text."job number" then moves to date/ time text box
[quoted text clipped - 16 lines]
 
-----------------------------------

In a new module:

Public LastDateTime as Date


Public Sub CheckTime()

' In the OnTimer event in your form, call this Subprogram.

Dim CheckDate as Date

CheckDate = Now

If DateDiff("h",LastDateTime,CheckDate) > 2 Then ' Two Hours
DoCmd.Close acForm, "MyForm"
End If

End Sub


Then, in any event(s) you want to code in your form:

LastDateTime = Now
 
Back
Top