Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh query that is a sub form in a tab control 2

Status
Not open for further replies.

redsand

Programmer
Aug 15, 2001
45
0
0
US
I have a tab control with several tabs. What I am trying to acomplish is this. When a user changes a usage field in one tab, I need to update another tab that has a form based on a query. I have tried the recalc and requery, it does not seem to work. The only thing that will update the tab is if I use the drop down to find the record again or of course close the form and re-open. I know this is an easy one. I hope I explained this well.

Thanks
 
When you use Requery are you requerying the main form or the subform as this should do the job?
If the former, try doing the latter:

eg:

Subformname.Form.Requery in the afterupdate event of your combobox.

John
 
I should have been more clear.

I have one tab called tooldata(main) and another called partusage. The tooldata main tab has a form called frmtooling & the partusage tab has a form called frmpartusage. Both forms are based on queries.

I pull the desired record using a drop down. All tabs are linked and populated after the combo is selected.

What I need to have happen is when I update the partusage field or any field for that matter in frmtooling, I need to have tooldata form update.

I have tried to put in me.requery in the activate/onload/gotfocus of frmtooling. It does not seem to work.

Thanks again.

 
In the afterupdate event of the combo box on your main form, put
frmPartusage.Form.Requery
frmTooling.Form.Requery

so that after changing the drop down it will update both the tabs. (at least, this should work).

John
 
I always forget the exact syntax for referring to subforms, so I always go to the same place in Help, which is "Refer to a form, report, subform, or subreport in an expression"

Here is the really helpful snipit from that topic:

Forms![Orders]![Orders Subform].Form

That syntax has never failed me.

For example:

Forms![Orders]![Orders Subform].Form.cboMyList.Requery

In an application I'm involved with, there was so much of this type of referencing, that we created global variables (as Form) so that we could refer to the forms in code using simply the global form name (ex: gfrmMyForm) rather than typing out all those long references all the time.

It really cuts down on the clutter, confusion and typing.
 
That was it!!
JR - I needed to update data between the tabs without going back to the combo box.

Private Sub Form_AfterUpdate()

Forms![frmedit]![frmTooling].Form.Requery

Thanks to both for the quick responses.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top