Compile Error - Filtering Data (1 Viewer)

dkinnz

Registered User.
Local time
Today, 08:01
Joined
Jan 8, 2007
Messages
29
I'm getting a Compile Error: "Method or Data Member Not Found", and I'm having trouble figuring how what I'm doing wrong in my code. Below in red is where the error is occuring...
Code:
Private Sub cmdSearch_Click()
Me[B][COLOR="Red"].subfrmFilter[/COLOR][/B].Form.RecordSource = "SELECT * FROM qryFilterGroup " & FilterIt
   
   Me.subfrmFilter.Requery
End Sub

The result I'm looking for in the user form is for the user to select a value from the combo box and clicks a Search button, and based on the combo box value the sub form will show those filtered results.

I have attached my database, so if anyone could please take a few moments to look it over I would really appreciate it!

Thank you in advance!
dkinnz
 

Attachments

  • dbGroup.zip
    229.7 KB · Views: 85

boblarson

Smeghead
Local time
Today, 06:01
Joined
Jan 12, 2001
Messages
32,059
One problem is your name of your subform control. Your subform control is named subfrmFilter1 and not subfrmFilter. Also you have other issues. Change the code to:
Code:
Private Sub cmdSearch_Click()
    Me.subfrmFilter1.Form.RecordSource = "SELECT * FROM qryFilterGroup " & FilterIt
    Me.subfrmFilter1.Requery
End Sub


Private Function FilterIt() As Variant
    Dim varFam As Variant

    If Me.cboGroup > 0 Then
        varFam = "[Group Name] = '" & Me.cboGroup & "'"
    End If
    
    FilterIt = "Where " & varFam
    
End Function
 

dkinnz

Registered User.
Local time
Today, 08:01
Joined
Jan 8, 2007
Messages
29
Thank you a ton for your reply! It works perfect now!
I owe ya a drink.
-dkinnz
 

Users who are viewing this thread

Top Bottom