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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform listboxs based on main form

Status
Not open for further replies.

emmy

MIS
Nov 7, 2000
22
US
I have a main form from which a user can select a location from a combo-box. I've added a tab with a sub form showing address, phone etc.
I've added another tab and sub form, I want this second sub form to have 4 list boxes which list people in each job at the location selected in the main form. The sub form has a record source that queries all the people at the selected location, including their job code. So, each list box needs to list people with a certain job code or job code range.
I've tried doing some sort of filter on the listbox control source, but I just can't seem to get it right.
Can anybody help with this?

 
Add a WHERE clause to the SQL of the RowSource property.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Well, I did that in the beginning but I found that I also need to re-apply the location number in the rowswource SQL of the listbox. I'm wondering how I can get the listbox to use only the people from the location that is selected in the main form. ie - have the listbox use the results from the sub form rather than query the database again.
The recordsource for the subform is like this:
Code:
SELECT People.JobCode, People.EMPLID, People.LAST, People.FIRST, People.MIDDLE
WHERE (((People.Location)=[forms]![frmmain].[cmbLocation]));
I want each listbox on the subfrom to further break out by JobCode.
Does that make sense?
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top