473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Filtering a subform

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

Nov 13 '05 #1
3 2586
Todd" <to**********@penland.net> wrote in message
news:Cu***************@fe25.usenetserver.com...
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"


Try...

Me.SubFormControlName.Form.Filter = "[intMyField] = 7"
Me.SubFormControlName.Form.FilterOn = True

Notice that you refeerence the name of the subform *control* which might not be
the same as the name of the form within it.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2
Todd, you need to use the subforms form object to use its Filter
property. Like...

Me.sfrMySubform.Form.Filter = "[intMyField] = 7"

Add that to your code and see how it works.

- Jim

On Sat, 31 Jul 2004 14:47:13 -0700, "Todd" <to**********@penland.net>
wrote:
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


Nov 13 '05 #3
Thank you - that did it. I appreciate the help.

"Rick Brandt" <ri*********@hotmail.com> wrote in message
news:2n************@uni-berlin.de...
Todd" <to**********@penland.net> wrote in message
news:Cu***************@fe25.usenetserver.com...
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"

Try...

Me.SubFormControlName.Form.Filter = "[intMyField] = 7"
Me.SubFormControlName.Form.FilterOn = True

Notice that you refeerence the name of the subform *control* which might

not be the same as the name of the form within it.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I...
5
by: Richard | last post by:
Hi, I have a form that take some time to load due to many comboboxes and at least 8 subforms. When I filter or sort the main form I get an error message and then Access shuts down. They ask if...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
4
by: Doug | last post by:
I have your typically form/subform. You enter the account number in a textbox and select whether you want to see the detail or summary information on the main form. Both fields I want to filter...
0
by: Jason | last post by:
I have a primary form which is used to enter/edit data in a table named Test_Results. On this primary form there is a subform which displays site addresses. This subform is linked to the primary...
3
by: Damon Grieves | last post by:
Hi I have a large table which I wanted to filter and then edit the selected record. I'm using a form with several pull down fields linked to lookup tables which correspond to fields in the large...
2
by: Katie | last post by:
I need to store a history of two fields in two seperate tables: Event - where the key is Event_ID Stage - where the key is Stage_ID The joins are: Main Table Event Table Stage Table ...
3
by: paquer | last post by:
On my Main form I have a Command Button that opens a Subform in order to create a new Subform record. At this point I want the subform to show only the new record being created. Not all the...
5
Scott Price
by: Scott Price | last post by:
Hello, I'm running Access 2003 trying to filter a subform with approximately 15 records per year per the main record contained on the parent form. The filter works fine if the subform is opened...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.