Repost: Getting a combo to re run its query

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

Noel

Hi, I posted this the other day and had a reply from HTH
which I couldnt understand and now its all gone quiet.
Can anyone else help me here?

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 the requery I have set refreshes
only the main subform, not its own subform. I've tried
changing one of my current requeries but I don't know
enough about the code. Can anyone help with this? How can
I set a requery to run on the click of a Tab Control form
that refreshes the main subform and all imbedded
subforms? The names are as follows

Tab Control Name TabCtl1
Tab Control Page Name PGCE
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.
 
You need to just keep adding items in the order they are on the form.

Form, subform control, subform, subform control, subform, control.

The subforms aren't actually on their parent form, they are in a subform
control on the parent form. You need to refer to this control, frequently
though, the control and the subform have the same name. Assuming that to be
the case here, since your current code works:

'For the 2nd subform
Me![Students PGCE]![Placements Subform].Requery
'For the combobox
Me![Students PGCE]![Placements Subform]!SchoolName.Requery

Since you are using the ! character instead of the . (dot) character, this
should work. With the dot character you would probably need to be slightly
more explicit.

Me.[Students PGCE].Form.[Placements Subform].Form.SchoolName.Requery
 
Thanks for such a comprehensive reply, Wayne.
Unfortunately I can't get to my db for a while now.
Please bear with me but it may be next week before I can
reply. Hopefully I can get it working OK but even if I do
I will get back to you. Thanks again, Noel
-----Original Message-----
You need to just keep adding items in the order they are on the form.

Form, subform control, subform, subform control, subform, control.

The subforms aren't actually on their parent form, they are in a subform
control on the parent form. You need to refer to this control, frequently
though, the control and the subform have the same name. Assuming that to be
the case here, since your current code works:

'For the 2nd subform
Me![Students PGCE]![Placements Subform].Requery
'For the combobox
Me![Students PGCE]![Placements Subform]! SchoolName.Requery

Since you are using the ! character instead of the . (dot) character, this
should work. With the dot character you would probably need to be slightly
more explicit.

Me.[Students PGCE].Form.[Placements Subform].Form.SchoolName.Requery

--
Wayne Morgan
MS Access MVP


Hi, I posted this the other day and had a reply from HTH
which I couldnt understand and now its all gone quiet.
Can anyone else help me here?

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 the requery I have set refreshes
only the main subform, not its own subform. I've tried
changing one of my current requeries but I don't know
enough about the code. Can anyone help with this? How can
I set a requery to run on the click of a Tab Control form
that refreshes the main subform and all imbedded
subforms? The names are as follows

Tab Control Name TabCtl1
Tab Control Page Name PGCE
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.


.
 
Hi Wayne. I hope you read this. Ive just introduced your
suggestion and it works fine. Thanks for the help.
Cheers, Noel
-----Original Message-----
You need to just keep adding items in the order they are on the form.

Form, subform control, subform, subform control, subform, control.

The subforms aren't actually on their parent form, they are in a subform
control on the parent form. You need to refer to this control, frequently
though, the control and the subform have the same name. Assuming that to be
the case here, since your current code works:

'For the 2nd subform
Me![Students PGCE]![Placements Subform].Requery
'For the combobox
Me![Students PGCE]![Placements Subform]! SchoolName.Requery

Since you are using the ! character instead of the . (dot) character, this
should work. With the dot character you would probably need to be slightly
more explicit.

Me.[Students PGCE].Form.[Placements Subform].Form.SchoolName.Requery

--
Wayne Morgan
MS Access MVP


Hi, I posted this the other day and had a reply from HTH
which I couldnt understand and now its all gone quiet.
Can anyone else help me here?

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 the requery I have set refreshes
only the main subform, not its own subform. I've tried
changing one of my current requeries but I don't know
enough about the code. Can anyone help with this? How can
I set a requery to run on the click of a Tab Control form
that refreshes the main subform and all imbedded
subforms? The names are as follows

Tab Control Name TabCtl1
Tab Control Page Name PGCE
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