Using Access 2000
I have a form called frmCustomers. On this form is a subform called fsubProjects, related to frmCustomers by CustomerID field.
On the subform, fsubProjects, there is a subform called fsubMaterials, related to fsubProjects by ProjectID field.
On fsubMaterials, I have 2 combo boxes.
One is called Category and is based on tblCategory which has 2 fields (CategoryID and Category).
The second is called Item and is based on tblItems which has 3 fields (ItemID, CategoryID and Item).
The two tables are related, one to many, on the CategoryID field.
In fsubMaterials, when I click on an entry in Category, I want the Item combo box to show only those items which have the same CategoryID as the entry selected in the Category combo box.
What I have done to try and accomplish this is place code on the AfterUpdate event for the Category combo box. That code is
What happens is that a parameter box appears asking for a CategoryID, and when I place the correct matching CategoryID the correct items appear in the Item combo box, but it won't run without this parameter intervention.
I have tried other formulations of the code, but can't get it to work correctly.
Can someone point me in the right direction.
Thanks.
Tom
I have a form called frmCustomers. On this form is a subform called fsubProjects, related to frmCustomers by CustomerID field.
On the subform, fsubProjects, there is a subform called fsubMaterials, related to fsubProjects by ProjectID field.
On fsubMaterials, I have 2 combo boxes.
One is called Category and is based on tblCategory which has 2 fields (CategoryID and Category).
The second is called Item and is based on tblItems which has 3 fields (ItemID, CategoryID and Item).
The two tables are related, one to many, on the CategoryID field.
In fsubMaterials, when I click on an entry in Category, I want the Item combo box to show only those items which have the same CategoryID as the entry selected in the Category combo box.
What I have done to try and accomplish this is place code on the AfterUpdate event for the Category combo box. That code is
Code:
Me.Item.RowSource = "SELECT tblItems.ItemID, tblItems.CategoryID, tblItems.Item FROM tblItems WHERE (((tblItems.CategoryID) = [Forms]![fsubMaterials]![Category]![CategoryID]));"
What happens is that a parameter box appears asking for a CategoryID, and when I place the correct matching CategoryID the correct items appear in the Item combo box, but it won't run without this parameter intervention.
I have tried other formulations of the code, but can't get it to work correctly.
Can someone point me in the right direction.
Thanks.
Tom