Filtering a subform

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

Guest

I need to filter a subform using the parent form's combo box. The subform
has a cmb box, and in the 3rd column is the id I would like to filter with
the parent frms cmb. The parent cmb and the subform cmb.column(2) are both
from the same table. Is this possible to do, and how do you do it? I tried
the following but failed:


Me.sfrmPositionAssignment.Form.FilterOn = True
Me.sfrmPositionAssignment.Form.Filter = "ShiftID.column(0) =
PositionID.column(2)"
Me.sfrmPositionAssignment.Requery
Me.sfrmPositionAssignment.SetFocus
 
Thanks for your help Allen. I don't know why I didn't do this before, but I
just used the query to filter the records. When the combo box is changes I
just requery the sub form using the AfterUpdate event of the cmb box. Thanks
again!
 
Hi James,
I'm new to Access and have a similar situation....you had mentioned below you
requery the subform using the AfterUpdate event....what/how do you this
requery?

Thansk,
CJC
Thanks for your help Allen. I don't know why I didn't do this before, but I
just used the query to filter the records. When the combo box is changes I
just requery the sub form using the AfterUpdate event of the cmb box. Thanks
again!
Instead of
[quoted text clipped - 8 lines]
For other examples of mixing literal values with variable values, see
the demo at http://www.aislebyaisle.com/access/tools2.htm
 
I am not an expert like Mr. Browne, but I will give a stab at it. You have
to use a query for the subform. In the build view of the query find the
field that you want the subform to be filtered by and type the following in
the Criteria section of that field:

Forms.FormName.ControlName (ControlName is the field on the main form that
filters the subform.)

On the main form, use the AfterUpdate event on the properties dialog box of
the control. You will have to use the code builder and type the following:

Me.SubformName.requery

HTH

CJG via AccessMonster.com said:
Hi James,
I'm new to Access and have a similar situation....you had mentioned below you
requery the subform using the AfterUpdate event....what/how do you this
requery?

Thansk,
CJC
Thanks for your help Allen. I don't know why I didn't do this before, but I
just used the query to filter the records. When the combo box is changes I
just requery the sub form using the AfterUpdate event of the cmb box. Thanks
again!
Instead of
[quoted text clipped - 8 lines]
For other examples of mixing literal values with variable values, see
the demo at http://www.aislebyaisle.com/access/tools2.htm
 
Thanks James, I'll give it a try
I am not an expert like Mr. Browne, but I will give a stab at it. You have
to use a query for the subform. In the build view of the query find the
field that you want the subform to be filtered by and type the following in
the Criteria section of that field:

Forms.FormName.ControlName (ControlName is the field on the main form that
filters the subform.)

On the main form, use the AfterUpdate event on the properties dialog box of
the control. You will have to use the code builder and type the following:

Me.SubformName.requery

HTH
Hi James,
I'm new to Access and have a similar situation....you had mentioned below you
[quoted text clipped - 14 lines]
 
Back
Top