Solved

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

Posted on 2013-01-17
2
515 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

622 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