Hi,
I've been told in another forum that I can apply a filter to a subform (from
a control on the main form) by using the following code:
Me.sfrMySubform.Filter = "[intMyField] = 7"
I've tried this solution but it isn't working for me. Here's my code:
Private Sub fraShowRows_Click()
Select Case Me.fraShowRows
Case 1 'Available
Me.fsubAutoParts.Filter = "fldRemoved = False"
Case 2 'Sold
Me.fsubAutoParts.Filter = "fldRemovedReason = 'Sold'"
Case 3 'Lost/Stolen
Me.fsubAutoParts.Filter = "fldRemovedReason = 'Lost/Stolen'"
Case 4 'All
Me.fsubAutoParts.Filter = ""
End Select
End Sub
----------
fraShowRows is an option group with four choices which the user clicks to
indicate which records they wish to view.
----------
When I click on any of the options in fraShowRows, I receive the following:
Compile error
Method or Data Member not found
The name of the subform is highlighted in my code after I click OK on the
error message.
I've come across something similar when trying to apply changes to a subform
from the main form in the past. These were solved by replacing the form
name of the subform (fsubAutoParts) with the control name of the subform
"[Auto Parts]" (without quotes) on the main form. The code now looks like
this:
Private Sub fraShowRows_Click()
Select Case Me.fraShowRows
Case 1 'Available
Me.[Auto Parts].Filter = "fldRemoved = False"
Case 2 'Sold
Me.[Auto Parts].Filter = "fldRemovedReason = 'Sold'"
Case 3 'Lost/Stolen
Me.[Auto Parts].Filter = "fldRemovedReason = 'Lost/Stolen'"
Case 4 'All
Me.[Auto Parts].Filter = ""
End Select
End Sub
Now I receive the same error:
Compile Error
Method or data member not found
but now the .Filter method is highlighted in my code.
I've done everything I know to do and still can't get this to work. Can
anyone offer any suggestions?
Thanks!
Todd