Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple "List Box" question

Status
Not open for further replies.

Tfrank

Technical User
Jun 19, 2001
30
US
In my database there are two tables one of which is the main table and a second child table. The relationship betweeen the main to child is one-to-many. I have a main form where data is entered going into the Main table, on the same form there is also a sub-form for entering data into the child table.

My question is that on the main part of the form I would like to use a list box to display some of the information that is entered into the subform. I would like only the informatiion to display data which is related to the data displayed on the main form. When I go to create the list box, it displays all information in the child table. I am sure there is a simple way for the list box to display only the data that pertains to the current main form displayed.
Thanks for the advice.
Tfrank.
 
Hi,

The quickest way would be to create an unbound combobox and then set its control as a query. Your query would look something like the example below. This example is only pulling data from a table where the data is equal to a field on the table (could be a customer ID, etc...)


SELECT * FROM Childtable.field WHERE (((table.fieldname)=[Forms]![FormName]![Field]));

HTH,

jbehrne

If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top