Subform in Subform 'loses' controls

GrandMasterTuck

In need of medication
Local time
Today, 03:57
Joined
May 4, 2013
Messages
129
Hi folks. A brain teaser:

I have a main form called frmMain. On it is a tab-control with two tabs. Tab 1, called INFO, has a subform called ctlPeople. Tab 2, called CARD, has a subform, called ctlCard.

At the top of frmMain, above the tab control, there is a combo-box that's set to fetch the ID numbers of all the employees in my main Employees table. This combo-box has an AfterUpdate event with a macro that is supposed to perform a SearchForRecord action on both ctlPeople AND on ctlCard. And it works perfectly. I can open the main form, select a record in the combo box, and when I tab out, both ctlPeople and ctlCard update to show me the record I selected.

Here's the problem: ctlCard's record list fields have double-click actions that set a SourceObject on a second control that's elsewhere on Tab 2 (CARD). Once I double-click a record, then go back to my main form combo box, it now will only refresh Tab 1 and ctlPeople, but ctlCard stops updating, and 'sticks' on the recordlist that contains the one I double-clicked. The only way I can get it to stop this is to exit the form and reopen it.

I've tried the following:

  1. Putting 'SelectObject' and 'GoToControl' actions in front of each of the 'SearchForRecord' actions in the macro... no dice
  2. Adding 'SelectObject' and 'Requery' commands after the AfterUpdate commands for the Combo Box... nothing
  3. Adding 'Requery' commands at the end of the SearchForRecord commands in the double click event of ctlCard's fields, and this gives me a 'No field named ctlCard in the current record' error. I even tried it with the full reference, Form!frmMain... etc. Still errors

It seems like my forms are 'forgetting' where to find ctlCard if I do the double-click action on a record within ctlCard, and it stops updating. As long as I don't double-click a record, though, the refresh works perfect on both tabs. What could be causing this, and how do I get around it? Thanks!
 
I think we'd need to see this to help. Can you upload the database?
 
You know, I guess I can mark this solved, even though I never solved the original dilemma. What I did instead was shift around the location of the controls, and that fixed it.

Before, I had a Main form with a Combo Box, and below that was a Tab Control with two tabs, and on each tab was a subform, one with the personal info, and one with the card. I was having trouble getting the Combo Box to update both subforms on each of those tabs after I'd double-clicked a record on one of them (which fired a SourceObject command on the other one).

So instead, I changed it around. Now on the Main form is a Subform with the Combo Box, and below the Combo Box are BOTH the other subforms (had to resize them and modify the layouts a bit so they both fit), and now the double-click event fires that SourceObject command perfectly, and the form no longer 'loses track' of the other subform.

I guess I would have to chalk this particular issue I had up to poor form design. Trying to get a Combo Box to update stuff on two different tabs is more effort than it's worth, and ultimately less user-friendly anyway. I'm beginning to think I'm just subconsciously challenging myself to try new things instead of designing a system that's intuitive and easy to use. Oh well.

Thanks for the reply, anyway!
 

Users who are viewing this thread

Back
Top Bottom