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!

Group fields for new records in a bound subform?

Status
Not open for further replies.

cookie5

Programmer
Jan 19, 2003
47
US
I posted something similar to this earlier and with your help was able to work though most of my problems, 1 remains and I'm not sure if it is possible, so here goes.
I have form with several subforms. The subform in question has a table as its source. The subform has 2 combo boxes, both BOUND to the table, 1 combo box has categories of parts, the 2nd displays the part name associated with the category combo box. That works great. When I want to add an additional part to the table, I want to use the category combo box to group the list of parts by the category I select so I can select a part. Now when I select the category and go to the parts combo box, it shows all the parts, not just for the category I selected.
I have tried requery in several event procedures. The sql for the parts rowsource is
SELECT DISTINCTROW Parts.PartID, Parts.PartName, Parts.Catid, [Parts Category].CatID, [Parts Category].[Category Name]
FROM Parts INNER JOIN [Parts Category] ON Parts.Catid = [Parts Category].CatID

I had a WHERE statement but it interfered with displaying ANY parts in the combo box.
Any ideas??
ORDER BY [Parts Category].[Category Name];


 
You'll need a WHERE clause in the RowSource for the Parts combobox.

Something like...
Code:
WHERE ((Parts.CatID)=forms![frmYourForm]![cboCategoryCombo]);

As you touch upon, you'll also need to requery on the after update event of the category combobox.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top