Link to home
Start Free TrialLog in
Avatar of jondecker76

asked on

Keeping a list box in sync with its parent form

I can't seem to keep a list box synced with its parent form.

Here is the layout:

I have the child and master fields between mainForm and subForm1 linked, so that the subform updates along with its parent. But the lstListbox control has a query of its own that must be updated whenever subForm1 is updated. I have tried putting me.lstListbox.requery in the onCurrent event of subForm1, but this causes an endlsee cycle of "Calculating...." to appear in the status bar, and the lstListbox to be continually requeried even if nothing is happening. Because of this, if I select a control, it goes out of focus as fast as I can try to keep in selected.

How can I make lstListbox stay in sync with its parent form (which is a subForm)?

Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

what is the rowsource of the listbox?
That's odd...

Is there any event for the control lstTags that could trigger this?
What about changing the code to:
lstTags.RowSource = lstTags.RowSource?
Avatar of jondecker76


This is the rowSource to the listbox:
SELECT Module_Input_List.FK_Point, Point.Tagname FROM (Module_Input_List INNER JOIN Point ON Module_Input_List.FK_Point=Point.PK_Point) INNER JOIN [Module] ON Module_Input_List.FK_Module=Module.PK_Module WHERE (((Module_Input_List.FK_Module)=Forms!frmEditPartitions!txtHiddenModuleKey));

I'm still not sure what could cause it to continually cycle like this when the OnCurrent event of the form is used
You may have to post a sample of your db here.
Well I have found what has been causing all of my odd bahaviors. It is something I have been plagued with this entire project.

For some reason, Access magically adds information in the wrong places. For example, if I change the query (record source) in a listbox on a subform, magically somewhere else in the project, that SELECT string will also show up as the WHERE clause in some other query, and sometimes it will show up in the Link CHild/Master fields.
Again, this is WITHOUT my intervention. I specifically change a query somewhere, then elsewhere in the project, the SELECT string from that query get placed in other fields.
I have been battling this, along with frequent (multiple times Daily) crashes (random lock-ups, "Not enough Memory to Perform this Operation" lockups, you name it). It has gotten so bad that I save and backup after EVERY change I make, or else I would lose everything.

We are using Access 2003 in a corporate environment, so I have no control over updates or patches, and I don't even know if what we are using is up to date with its updates.

For now, what is working is completely re-creating the form/controls/VBA code for objects causing this behavior, and it seems to go away.
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you! I had no idea about this feature, disabling it seems to have fixed my problem!