Filter subform with combo box on main form

  • Thread starter Thread starter Opal
  • Start date Start date
O

Opal

Using Access 2003, I am trying to filter a subform
using a combo box on my main form. My main
form is unbound.

I want the user to be able to select an Area from
the combo box on the main form and the
subform populates with functions performed
in that area.

My subform is bound to my Function table
and the row source for my Areaname combo
box is from my Area Table.

I thought it would simply be something like:

Me.Filter = [AreaName] = Me!subfrmFunction.Form.AreaID
Me.FilterOn = True

In my after update event for the combo box....

but that didn't work

So I went searching and got even more confused

If I use something like:

Dim strSql As String

strSql = " SELECT * from Functiontbl where Functiontbl.AreaID="
& Form![frmFunctionUpt]![AreaName]
Me.subfrmFunction.RecordSource = strSql
Me.subfrmFunction.Requery

But I get a compile error -

Method or Data member not found
and it highlights "RecordSource"

Can anyone help me out?
 
Got it!

Me.subfrmFunction.Form.Filter = "[AreaID] = " & Me.AreaName
Me.subfrmFunction.Form.FilterOn = True

In the after update event for the combo box
 
Back
Top