Solved

Need Help Filtering Combox box on Subform with Data in Combobox on Main form

Posted on 2013-01-17
2
502 Views
Last Modified: 2013-02-15
I am trying to filter a combobox by running a query that contains the data from a combobox on the parent form. How can I reference the Parent forms combobox's value in my query?

Current Query to select all records
Select Part From PartList

I would like to be able to reference the combobox on the parent form so I can do this:
Select Part From PartList where ProductLine = 'PL'

I have attached a screenshot of the form. It is currently an Access 2010 ADP.
screenie.png
0
Comment
Question by:tekkieguru
2 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 38789078
Select Part From PartList where ProductLine = Forms!ParentFormName.cboParts

The problem you will have is that the subform actually loads before the main form, so when the subform trys to evaluate this SQL statement, the Parent forms cboParts will not contain a value, and may generate an error.

For this reason, I generally leave the subforms SourceObject property blank, then in the Main forms "Load" event, I will set the subforms SourceObject.

HTH
Dale
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38789211
have you tried setting the master/child link fields

master link field cboParts
child link field  [ProductLine]
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL STANDARD CORE 8 40
SQL Server query - can a #temp table be improved with indexing? 6 46
SQL Recursion 6 20
Treeview control in 64 bit Office. 2 25
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question