updating data on a subform with data from another subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a tab control. One tab has a subform with 12 months worth of data. A second tab has a subform that rolls up the 12 months of data into a line item of data for the year. When I change the data on the first tab (monthly data) and navigate to the second tab, I want to see the change already incorporated into the second tabs data.

I've tried to requery the second subform On Activate, On Enter, and everything else, and nothing works. I have been successful with setting up a button to requery the form, and that gives me the correct data. But I don't want toforce the user to press a button. (they will invariably forget, and wonder why the data is wrong).

Anybody know how to update an open tab control subform on enter?
 
My recommendation would be to do the requery using the OnChange event of the
tab control. Test the value of the tab control to see which page is about to
be displayed (the value is the page index of the current page) then do the
requery from the mainform.
 
Hi Kevin,

I'm not sure what might be causing the "Action Failed" error. Requerying the
main form will not force a requery of the subform, instead you need to
requery the subform control of the main form. In the form designer, click
once on the subform then look at the Other tab of the property sheet. Check
the Name property to get the name of the subform control - this is what you
need to requery.

You don't actually requery the tabs - because a tab is just a container for
controls - the tab page itself is not bound to any data source, thus it
can't be requeried. The subform control is a different matter.

You can still do this with macros - I'm not sure you can check the value of
the tab control but if you requery using the change event of the tab control
it should be fine. The downside is that it is going to requery every time
you change tab pages, rather than only when the subform is becoming visible.
 
Back
Top