Solved Continuous Firing of Sub-Form OnCurrent Event (1 Viewer)

Fran Lombard

Registered User.
Local time
Today, 14:16
Joined
Mar 12, 2014
Messages
132
I am having a problem with on of my forms where the SubForms are continuing to fire off the OnCurrent Event long after the form has loaded.

Main form has a Tab Control which contains a subform (datasheet) on each tab.
Each subform has a Public Event defined (CurrentID) which is raised from the SubForms-Form_Current Event.
This event is captured on the Main Form and used to Set the value of a Combo box.
For some reason the events continue to fire every 1/2 second or so.

Anyone have an idea what could be causing this?
 

Attachments

  • Screenshot.zip
    151.4 KB · Views: 208

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:16
Joined
May 21, 2018
Messages
8,525
Is there any use of the timer event anywhere in the main for subforms?
 

LarryE

Active member
Local time
Today, 11:16
Joined
Aug 18, 2021
Messages
581
If you want to just have events fire once when the form is loaded, then use the On Load event or On Open. The On Current event fires numerous times if you have subforms and for other reasons.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:16
Joined
Feb 28, 2001
Messages
27,146
If it is an "endless" loop that never settles down after a few seconds then you must be triggering a data save/change action in one of the subs. That is, you change one of the bound fields in the sub and somehow trigger a SAVE event. This COULD occur as an interaction between forms in that the main could do something to a sub and the sub could then be triggered by the main's action to do something that would retrigger the main's event. That would become a truly ugly situation.

If the event routines involved are not very long, it might be worthwhile to set a breakpoint in the main's OnCurrent and then single-step to see if there is an action, event, or sub/function call that steps out of the code context to touch something outside of itself in a way that triggers something on the external context. (You did say that there is a combo that is affected in an "out-of-context" sequence.) See what ELSE is affected by that.
 

Fran Lombard

Registered User.
Local time
Today, 14:16
Joined
Mar 12, 2014
Messages
132
If it is an "endless" loop that never settles down after a few seconds then you must be triggering a data save/change action in one of the subs. That is, you change one of the bound fields in the sub and somehow trigger a SAVE event. This COULD occur as an interaction between forms in that the main could do something to a sub and the sub could then be triggered by the main's action to do something that would retrigger the main's event. That would become a truly ugly situation.

If the event routines involved are not very long, it might be worthwhile to set a breakpoint in the main's OnCurrent and then single-step to see if there is an action, event, or sub/function call that steps out of the code context to touch something outside of itself in a way that triggers something on the external context. (You did say that there is a combo that is affected in an "out-of-context" sequence.) See what ELSE is affected by that.
Thanks The_Doc_Man - I followed you suggestion and did find a SAVE embedded in one of methods - commented it out and all is good. The Save really should not have been there so functionality is now as indetended.
 

Users who are viewing this thread

Top Bottom