Subform ApplyFilter Problem

J

Jake Jessup

Hello all,

I'm having a problem with 'ApplyFilter' in a subform and I'm hoping someone
can help.

Main form = frmFullInfo (Record Source is tblCustomer)
Sub form = subFullInfo (Record Source is tblAgent)
Sub form control name = subFullInfo (Linked on CustomerID)

Using the following code:
'***Begin Code***
Private Sub cmdAgent_Click()

Dim strInput As String

strInput = Me.cboAgent

Me.Filter = "Agent = '" & strInput & "'"
Me.FilterOn = True

End Sub
'***End Code***

The desired result would be that I see only those records in the main form
that were filtered on the subform.
What I'm actually getting is all of the records in the main form, but only
the filtered records in the subform.

I tried .requery on both the main form, the sub form and that made no
difference.

Any help is appreciated,

Jake
 
H

HSalim

Jake

It looks like you could end up going in circles on this one.
Filters should go from Main form to subform, not the other way.

Now, to really accomplish waht you want, your main form should become a
subform to a new form
that displays just Customer and Agent (usually in a combobox)
Use the customer id to filter frmFullInfo - this automatically filters the
sub form
use the agent id to further filter the subform by agent
 

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