473,406 Members | 2,620 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.

Filter main form by clicking on cell in subform?

70 64KB
I've got a form which contains an unbound subform in the detail portion. The subform is not linked to the mainform. It displays all information from tblEquipment.

In the header, I have several combo boxes and text boxes used to either add a new record to tblEquipment or to make changes to records in tblEquipment.

In the footer, I have a search form
This search form filters the subform and it also filters the main form. So, I can select say... a specific. Equipment Serial Number and see that record's information in the header combo boxes (these all being bound to a query).

What I would like to do is make it so that if you double click on a cell in the subform, the main form would be filtered. For instance, suppose I click on serial number "12345", I should then see that record in the main form.

...how is this done? I imagine the code needs to go in the subform. If I'm right, I'm not sure how to refer to the main form from the subform.
Nov 18 '15 #1

✓ answered by mbizup

Hi - Glad you worked it out. Filtering a mainform from it's subform is not a very common practice (it seems a little like the tail wagging the dog :-) )

If you haven't worked out your follow up question yet, try using the 'Parent' property instead of hardcoding. Ie:

Me.Parent.Filter = "Blah"
Me.Parent.FilterOn = True

4 1764
ittechguy
70 64KB
Figured it out!

I just had to add this code to a text box in the subform:

Expand|Select|Wrap|Line Numbers
  1. Private Sub SerialNum_DblClick(Cancel As Integer)
  2. Forms!frmPopupChangeEquipment.Form.Filter = "SerialNum = '" & SerialNum & "'"
  3. Forms!frmPopupChangeEquipment.Form.FilterOn = True
  4. End Sub
  5.  
One question though, because I am using a navigation form, I cannot hard code the path as you see above. I need to use "Me."

...Not sure what that would be.
Nov 18 '15 #2
mbizup
80 64KB
Hi - Glad you worked it out. Filtering a mainform from it's subform is not a very common practice (it seems a little like the tail wagging the dog :-) )

If you haven't worked out your follow up question yet, try using the 'Parent' property instead of hardcoding. Ie:

Me.Parent.Filter = "Blah"
Me.Parent.FilterOn = True
Nov 18 '15 #3
NeoPa
32,556 Expert Mod 16PB
In case of interest see Example Filtering on a Form.

Otherwise, Miriam has already given a very good answer to your question.
Nov 18 '15 #4
ittechguy
70 64KB
Thanks for the help! Me.Parent works perfectly.

Yea, I realize it seems backwards, but it does what I need it to do.
Nov 19 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: ethanj /personal/ | last post by:
I have main form with subform, similar to the Order Details form in the Northwind database. The the main form record locking is released when I click to edit subform's records. Is there away to...
4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
1
by: gleave | last post by:
Hi, I have a problem with subforms. I want to lock a subform until all the required data is inputted in the main form. The required fields in main form: Invoice Number Invoice to The main...
0
by: theBman | last post by:
I have 2 tables. One master, one child using Access 2003 (PC) Have 2 forms. The main form is continuous while the sub is datasheet. I can filter on the main form and the subform filters with...
2
by: stpark22 | last post by:
Hello, I've constructed a form that contains a subform in Access 2003. I want to be able to set the tab order to tab through the fields of the main forms then tab through the fieldw of the subform...
3
by: MGC | last post by:
I am using MS Access 97. I am trying create a log of record set additions to a table containing product inventory locations. Would like to add the date and time stamp to the just-saved data in the...
1
by: Bface | last post by:
Hi All, I am stuck on a problem and hope someone can help me out. I have 8 users who will be using a form . For the users to access their accounts I use the SendKeys function, the user click on...
27
by: tragaz | last post by:
Hi There, I'm a beginer in Access and VB. In my Database, I've got a form with a subform. the subform is a query from a table different than the table of the main form. those tables don't have a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
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...
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
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...
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.