Subform filter is inherited?

J

John Keith

Is there anyway to seperate the me.filteron property between the mainform and
subform?

My subform has a button that launches a popup form that passes back a 1:M
key that shows the multiple matching rows in the sub-form detail section.

My mainform has the above sub-form in its header section, along with more
unbound search boxes that build a filter string specifically for the
mainform. Sub and Main are not linked by any key fields. I can apply a
filter string to the mainform and the main-detail rows change to match the
filter, at the same time, the sub-form's previously filtered rows remain
static. My purpose in designing it this way is to allow clicking on a
main-detail to cause it to change the foreign key to match the selected key
in the sub-form. This all works fine.

The issue comes along when I want to reset my main-form filter, it is also
effecting the sub-form. Digging through the Me. object variables I can only
find 1 reference to the Me.FilterOn variable. The Me.Controls(subform).___
does not contain a FilterOn setting.

So is it impossible to have a subform-filter on at the same time that the
form-filter is off?

This is using Office 2003's Access w/All SPs applied.
 
K

Klatuu

The subform, being a form, has its own Filter and Filter On properties.
It is a matter of addressing it correctly. If the code is in the subform's
module, it would be a stanard:
Me.Filter = "[Foobar] = " & ...
If the code is in the main form's module it would be:
Me.SubFormControlName.Form.Filter = ....

SubFormControlName is the name of the subform control on the main form, not
the name of the form being used as a subform.
 
J

John Keith

Thanks for clarifying.

I didn't dig deep enough into the me.subform.FORM... branch to see that.

--
Regards,
John


Klatuu said:
The subform, being a form, has its own Filter and Filter On properties.
It is a matter of addressing it correctly. If the code is in the subform's
module, it would be a stanard:
Me.Filter = "[Foobar] = " & ...
If the code is in the main form's module it would be:
Me.SubFormControlName.Form.Filter = ....

SubFormControlName is the name of the subform control on the main form, not
the name of the form being used as a subform.
--
Dave Hargis, Microsoft Access MVP


John Keith said:
Is there anyway to seperate the me.filteron property between the mainform and
subform?

My subform has a button that launches a popup form that passes back a 1:M
key that shows the multiple matching rows in the sub-form detail section.

My mainform has the above sub-form in its header section, along with more
unbound search boxes that build a filter string specifically for the
mainform. Sub and Main are not linked by any key fields. I can apply a
filter string to the mainform and the main-detail rows change to match the
filter, at the same time, the sub-form's previously filtered rows remain
static. My purpose in designing it this way is to allow clicking on a
main-detail to cause it to change the foreign key to match the selected key
in the sub-form. This all works fine.

The issue comes along when I want to reset my main-form filter, it is also
effecting the sub-form. Digging through the Me. object variables I can only
find 1 reference to the Me.FilterOn variable. The Me.Controls(subform).___
does not contain a FilterOn setting.

So is it impossible to have a subform-filter on at the same time that the
form-filter is off?

This is using Office 2003's Access w/All SPs applied.
 
K

Klatuu

Not to worry, it is a common misunderstanding. I don't know that the concept
is explicitly explained in any place obvious. But this is the how it works.

What you see of the main form is the form being used as the subform, but
when you go into design view of the main form, what you see is a subform
control. A subform control is like other controls. One of a subform
control's properties is the Source Object property. This property is a
reference to the form object that is contained in the subform control. But,
you refer to it as Form. Don't Ask, Don't Know.

--
Dave Hargis, Microsoft Access MVP


John Keith said:
Thanks for clarifying.

I didn't dig deep enough into the me.subform.FORM... branch to see that.

--
Regards,
John


Klatuu said:
The subform, being a form, has its own Filter and Filter On properties.
It is a matter of addressing it correctly. If the code is in the subform's
module, it would be a stanard:
Me.Filter = "[Foobar] = " & ...
If the code is in the main form's module it would be:
Me.SubFormControlName.Form.Filter = ....

SubFormControlName is the name of the subform control on the main form, not
the name of the form being used as a subform.
--
Dave Hargis, Microsoft Access MVP


John Keith said:
Is there anyway to seperate the me.filteron property between the mainform and
subform?

My subform has a button that launches a popup form that passes back a 1:M
key that shows the multiple matching rows in the sub-form detail section.

My mainform has the above sub-form in its header section, along with more
unbound search boxes that build a filter string specifically for the
mainform. Sub and Main are not linked by any key fields. I can apply a
filter string to the mainform and the main-detail rows change to match the
filter, at the same time, the sub-form's previously filtered rows remain
static. My purpose in designing it this way is to allow clicking on a
main-detail to cause it to change the foreign key to match the selected key
in the sub-form. This all works fine.

The issue comes along when I want to reset my main-form filter, it is also
effecting the sub-form. Digging through the Me. object variables I can only
find 1 reference to the Me.FilterOn variable. The Me.Controls(subform).___
does not contain a FilterOn setting.

So is it impossible to have a subform-filter on at the same time that the
form-filter is off?

This is using Office 2003's Access w/All SPs applied.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top