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.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1
|
|
0
|
|
|
|
Reply
|
vircalendar
|
1/1/2010 11:41:03 PM |
|
"vircalendar via AccessMonster.com" <u4313@uwe> wrote in message
news:a17b61380e44a@uwe...
> 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.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1
You should be able to do this by tracking Screen.ActiveControl and/or
Screen.ActiveForm using your background timer. (Untried)
HTH
|
|
0
|
|
|
|
Reply
|
Stuart
|
1/2/2010 12:50:25 AM
|
|
I am doing that. Problem is that screen.active control only tells me what's
in the control when it becomes active or is updated. It doesn't give me real-
time feedback while the active control is being edited. What I need to know
is whether or not there is active work being done on the field (ie keyup).
Again, what I'm specifically asking is whether or not I can track the keyup
event as it occurs on a different form.
Stuart McCall wrote:
>> Is there any way to have VBA code in one form test for events that are
>> occurring on another? Something like:
>[quoted text clipped - 33 lines]
>> a heirarchy so that if the second form opens a third, its own timer stops
>> while the third form is completed.
>
>You should be able to do this by tracking Screen.ActiveControl and/or
>Screen.ActiveForm using your background timer. (Untried)
>
>HTH
--
Message posted via http://www.accessmonster.com
|
|
0
|
|
|
|
Reply
|
vircalendar
|
1/2/2010 1:45:16 AM
|
|
"vircalendar via AccessMonster.com" <u4313@uwe> wrote in message
news:a17c77133434c@uwe...
>I am doing that. Problem is that screen.active control only tells me
>what's
> in the control when it becomes active or is updated. It doesn't give me
> real-
> time feedback while the active control is being edited. What I need to
> know
> is whether or not there is active work being done on the field (ie keyup).
> Again, what I'm specifically asking is whether or not I can track the
> keyup
> event as it occurs on a different form.
>
I can't see a way of catching keystrokes, but you could try examining the
SelLength, SelStart, and SelText properties of the control, perhaps?
> Stuart McCall wrote:
>>> Is there any way to have VBA code in one form test for events that are
>>> occurring on another? Something like:
>>[quoted text clipped - 33 lines]
>>> a heirarchy so that if the second form opens a third, its own timer
>>> stops
>>> while the third form is completed.
>>
>>You should be able to do this by tracking Screen.ActiveControl and/or
>>Screen.ActiveForm using your background timer. (Untried)
>>
>>HTH
>
> --
> Message posted via http://www.accessmonster.com
>
|
|
0
|
|
|
|
Reply
|
Stuart
|
1/2/2010 2:36:26 AM
|
|
I don't think that any of those will change until the control is updated. As
far as I know, the only way to trap keystrokes is the keyup/keydown approach,
so I'm wondering whether those events can be captured by another form.
Stuart McCall wrote:
>>I am doing that. Problem is that screen.active control only tells me
>>what's
>[quoted text clipped - 6 lines]
>> keyup
>> event as it occurs on a different form.
>
>I can't see a way of catching keystrokes, but you could try examining the
>SelLength, SelStart, and SelText properties of the control, perhaps?
>
>>>> Is there any way to have VBA code in one form test for events that are
>>>> occurring on another? Something like:
>[quoted text clipped - 7 lines]
>>>
>>>HTH
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1
|
|
0
|
|
|
|
Reply
|
vircalendar
|
1/2/2010 2:49:47 AM
|
|
"vircalendar via AccessMonster.com" <u4313@uwe> wrote in message
news:a17d0721ba4d6@uwe...
>I don't think that any of those will change until the control is updated.
>As
Try it. You'll find they update as editing takes place.
> far as I know, the only way to trap keystrokes is the keyup/keydown
> approach,
> so I'm wondering whether those events can be captured by another form.
I don't see a solution to that which doesn't involve putting code in the
form's KeyDown event.
>
> Stuart McCall wrote:
>>>I am doing that. Problem is that screen.active control only tells me
>>>what's
>>[quoted text clipped - 6 lines]
>>> keyup
>>> event as it occurs on a different form.
>>
>>I can't see a way of catching keystrokes, but you could try examining the
>>SelLength, SelStart, and SelText properties of the control, perhaps?
>>
>>>>> Is there any way to have VBA code in one form test for events that are
>>>>> occurring on another? Something like:
>>[quoted text clipped - 7 lines]
>>>>
>>>>HTH
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1
>
|
|
0
|
|
|
|
Reply
|
Stuart
|
1/2/2010 4:01:51 AM
|
|
|
5 Replies
204 Views
(page loaded in 0.087 seconds)
Similiar Articles: Order of Events on Form/Subform (?) - microsoft.public.access ...As long as I don't make mistakes in the testing ... I have a form/subform. They are linked on the field 'cnum'. ... Events occur for forms when you open or close a form, move ... Set control AfterUpdate event to procedure in another module ...... in a different module? i.e. By setting in the OnFormLoad() event: cbo ... work when they are in the same module of the form? ... record, the form's AfterUpdate event does occur. Access 97 to 2003 - difference in subform load event - microsoft ...... form with a linked subform (master/child) with code in the subform load event The subform code test... ... different ... form ... Note Because the events for a subform occur ... Disable Button If - microsoft.public.access.formsyes, you can use the form current event to test values ... If they need to add another visit to this ... enable a button according to client events that occur on ... Can I add data to two tables, using one form? - microsoft.public ...... also want the new customer form to grow as new customers occur ... really need to pop up a new form, perhaps in the NotInList event ... form as subform in Patient form (they ... How to automatically refresh a form - microsoft.public.access ...This is a form they typically leave open most of the day. ... is the frequency you want the OnTimer event to occur in ... The source data tab always has a different number of ... How to unlock fields on form to add - microsoft.public.access ...In the BEFORE INSERT event on the form, I ... This event is commonly used to ask the user if they want to add the new ... add field to form from different table ... Change Control Source - microsoft.public.access.formscoding ...I am using one form for two slightly different purposes. ... or control in the form'sOpen event. If the form's ... box control on nearly every form or report that they ... Date input mask - microsoft.public.access.forms... perhaps via another setting/form/query/different ... like that, use the AfterUpdate event procedure of the control on your form ... I don't know how this can happen since ... OnClick event name - microsoft.public.dotnet.languages.csharp ...Using Visual Studio with Forms events, the "functions ... event from within > the class where the event exists, but they ... through a bug that went through all tests to the ... test for events as they occur on a different form DataBaseIs 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 The Process of Speciation - University of Michigan... role of history, in that past events have an influence over what changes occur ... reproductive cells duplicate to form ... They may be so different that they do not even ... AP PSYCHOLOGY EXAM REVIEW... encourage us to process events deeply so they ... Chemical senses; they send impulses to the brain in the form of ... with daily stress and events during REM sleep. Occur ... Recall (memory) - Wikipedia, the free encyclopediaPsychologists test these forms of recall as a way to ... is the ability to recall items or events in the order in which they ... Moreover they occur in certain regular ways ... Precognition - Wikipedia, the free encyclopediaThe test of precognition was based on the fact ... Unconscious enactment in which people bring events that they ... connected and so only by "coincidence" do they occur ... 7/26/2012 11:47:58 AM
|