V
vircalendar via AccessMonster.com
Is there any way to have VBA code in one form test for events that are
occurring on another? Something like:
public otheractiveform.form_keyup()
do stuff
end sub
The idea is to have a form that's always open run a test generically on
whatever other form happens to have the focus at that time, and to do it
without having to write any supporting code on the other form.
Here's the quick rundown on why I ask:
I already use a hidden form that tracks how long it's been since the focus
has been changed to a new active control and closes the db if it's been idle
for more than an hour (thanks Lebans). What I would like to do is use that
same code to close individual forms that have been open and idle for more
than a specified amount of time (like 40 seconds). That's easy enough--just
close the active form if the active control hasn't changed focus during that
time--but I don't want to close a form while someone is editing the active
control. I could test whether the control is dirty, but that would only tell
me that a change has been made, not that someone is still actively working on
the control. If I halt the shutdown for a dirty control and the user doesn't
update it, then the control stays dirty and the whole process gets stuck.
Another solution is to abandon the background timer and instead put a timer
event on each form that looks for the keyup event, but the problems there are
that 1) I have to code every form (there are many) and 2) I have to build in
a heirarchy so that if the second form opens a third, its own timer stops
while the third form is completed.
occurring on another? Something like:
public otheractiveform.form_keyup()
do stuff
end sub
The idea is to have a form that's always open run a test generically on
whatever other form happens to have the focus at that time, and to do it
without having to write any supporting code on the other form.
Here's the quick rundown on why I ask:
I already use a hidden form that tracks how long it's been since the focus
has been changed to a new active control and closes the db if it's been idle
for more than an hour (thanks Lebans). What I would like to do is use that
same code to close individual forms that have been open and idle for more
than a specified amount of time (like 40 seconds). That's easy enough--just
close the active form if the active control hasn't changed focus during that
time--but I don't want to close a form while someone is editing the active
control. I could test whether the control is dirty, but that would only tell
me that a change has been made, not that someone is still actively working on
the control. If I halt the shutdown for a dirty control and the user doesn't
update it, then the control stays dirty and the whole process gets stuck.
Another solution is to abandon the background timer and instead put a timer
event on each form that looks for the keyup event, but the problems there are
that 1) I have to code every form (there are many) and 2) I have to build in
a heirarchy so that if the second form opens a third, its own timer stops
while the third form is completed.