Filter subform with combo box on main form



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

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

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