473,796 Members | 2,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Cli ck()
Select Case Me.fraShowRows
Case 1 'Available
Me.fsubAutoPart s.Filter = "fldRemoved = False"
Case 2 'Sold
Me.fsubAutoPart s.Filter = "fldRemovedReas on = 'Sold'"
Case 3 'Lost/Stolen
Me.fsubAutoPart s.Filter = "fldRemovedReas on = 'Lost/Stolen'"
Case 4 'All
Me.fsubAutoPart s.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_Cli ck()
Select Case Me.fraShowRows
Case 1 'Available
Me.[Auto Parts].Filter = "fldRemoved = False"
Case 2 'Sold
Me.[Auto Parts].Filter = "fldRemovedReas on = 'Sold'"
Case 3 'Lost/Stolen
Me.[Auto Parts].Filter = "fldRemovedReas on = '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 2614
Todd" <to**********@p enland.net> wrote in message
news:Cu******** *******@fe25.us enetserver.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.SubFormContr olName.Form.Fil ter = "[intMyField] = 7"
Me.SubFormContr olName.Form.Fil terOn = 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**********@p enland.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_Cli ck()
Select Case Me.fraShowRows
Case 1 'Available
Me.fsubAutoPart s.Filter = "fldRemoved = False"
Case 2 'Sold
Me.fsubAutoPart s.Filter = "fldRemovedReas on = 'Sold'"
Case 3 'Lost/Stolen
Me.fsubAutoPart s.Filter = "fldRemovedReas on = 'Lost/Stolen'"
Case 4 'All
Me.fsubAutoPart s.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_Cli ck()
Select Case Me.fraShowRows
Case 1 'Available
Me.[Auto Parts].Filter = "fldRemoved = False"
Case 2 'Sold
Me.[Auto Parts].Filter = "fldRemovedReas on = 'Sold'"
Case 3 'Lost/Stolen
Me.[Auto Parts].Filter = "fldRemovedReas on = '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*********@ho tmail.com> wrote in message
news:2n******** ****@uni-berlin.de...
Todd" <to**********@p enland.net> wrote in message
news:Cu******** *******@fe25.us enetserver.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.SubFormContr olName.Form.Fil ter = "[intMyField] = 7"
Me.SubFormContr olName.Form.Fil terOn = 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
11106
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 have a primary form named TestResults, which is connected to data in a table named TestResults. There are basically two other tables that are related to the TestResults table (and the primary form) named Names-Normalized and SiteAddresses. The...
5
3092
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 I want to send the error report to Microsoft. Has anybody seen this type of error message and what can I do to prevent it from happening. Am I doing something illegal in my code? It used to work but I have added conditional formatting to a subform...
19
3574
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 form, the subform returns the records based on the two criteria. The criteria used on the main form are values selected in two list boxes. When the user clicks on the first list box (lstCollege), it returns values in the second list box...
4
8953
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 on are text. Here is a sample of the code I am using. The filtering works fine when I do them independently (see below) Forms!..Form.Filter = " =" & Me! Forms!..Form.Filter =
0
2022
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 form by field named TestID. The subform is used just for displaying site address data, data which is stored in another table named Total_Site_Address. In the Total_Site_Address table there are numerous fields that form the site addresses...
3
1994
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 table. The user selects a number or category or All from the pull-down and this is used in a query, made up of the main table and the lookup tables with a suitable Iif statement to filter the query. So on the form there are several fields that...
2
1612
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 My screen has:
3
5388
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 records the subform's table has. I cannot put the subform as Data Entry because I cannot print the main form & subform together if the subform is "data entry". (comes up blank every time)
5
2786
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 independently, and right-clicking on the subform after opening the main form, and choosing filter by selection also works. The problem is getting the filter to apply when the parent form opens. I've checked for spelling errors a dozen times, what I...
0
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10012
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7548
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.