Getting a Combo to rerun its query

  • Thread starter Thread starter Noel
  • Start date Start date
N

Noel

Hi. I am using a Tab Control, with a subform showing on
each tab. I have a number of requeries set, using the Tab
Controls On Change event, so that when each Tab is
chosen, the query that supplies that Tabs Subform is
rerun. This all works fine. Some of these subforms have
their own subforms and the problem is with a Combo on one
of these subforms subform. When I change the records that
are supplied to the Combo via a query, the new records
don't show unless I close down the Tab Control Form and
then open it again. So I need to set a requery action
that reruns the Combo boxes query, when the main subform
is opened. I've tried changing one of my current
requeries but I don't know enough about the code. Can
anyone help with this? The names are as follows

Tab Control Name TabCtl1
Main Subform Name [Students PGCE]
Subform Name [Placements Subform]
Subforms Combo Name SchoolName
Combos query Name qrySchoolsWhoHaveOffered

My current requery code is

If Me!TabCtl1 = Me!PGCE.PageIndex Then Me![Students
PGCE].Requery


Thanks, Noel.
 
in code, whever it is use the parent property if you are not at the main
form level: if code is in a subform, then me.parent.refresh, or if it is a
subform within a subform me.parent.parent.refresh
this will refresh the entire datasources, to include comboboxes, subforms,
etc.
HTH
 
Note on last reply. If the records will be different than the current
records displayed then substitute requery for refresh in your code.
 
Hi. Thanks for your replies but Im not sure what you
mean. My requery code is in the On Change event of the
Tab Control form. Are you saying that I could put some
sort of additional Refresh code somewhere? Or do you mean
I should add it somehow to my existing Requery code?
Could I put something in the subforms On Open event
maybe? Just to repeat, my combo is in the subform of a
subform of a Tab Control Page. Can you expand a little
please? Thanks again, Noel
-----Original Message-----
in code, whever it is use the parent property if you are not at the main
form level: if code is in a subform, then
me.parent.refresh, or if it is a
subform within a subform me.parent.parent.refresh
this will refresh the entire datasources, to include comboboxes, subforms,
etc.
HTH
Hi. I am using a Tab Control, with a subform showing on
each tab. I have a number of requeries set, using the Tab
Controls On Change event, so that when each Tab is
chosen, the query that supplies that Tabs Subform is
rerun. This all works fine. Some of these subforms have
their own subforms and the problem is with a Combo on one
of these subforms subform. When I change the records that
are supplied to the Combo via a query, the new records
don't show unless I close down the Tab Control Form and
then open it again. So I need to set a requery action
that reruns the Combo boxes query, when the main subform
is opened. I've tried changing one of my current
requeries but I don't know enough about the code. Can
anyone help with this? The names are as follows

Tab Control Name TabCtl1
Main Subform Name [Students PGCE]
Subform Name [Placements Subform]
Subforms Combo Name SchoolName
Combos query Name qrySchoolsWhoHaveOffered

My current requery code is

If Me!TabCtl1 = Me!PGCE.PageIndex Then Me![Students
PGCE].Requery


Thanks, Noel.


.
 
Back
Top