我有一个问题,关于如何链接一个列表框上的选定项目,并以相同的形式显示在另一个列表框上......这就是我想要的:
我有一个名为category的表,它具有以下值:
category table:
categorynumber (primary key) int not null,
categoryname varchar() not null,
Parentcategory (foreign key refering to categorynumber)int not null,
categoryfollowingnumber int not null.
我想从category,subcategory和subsubcategory中选择。因此
listbox1(category1),
listbox2(subcategory based on category1)
listbox3 (sub-sub category based on subcategory)
listbox1: select category: Car
listbox2: display: toyota
listbox3: display: toyota corola
我可以在listbox1中看到category1,但基于所选类别的链接是我被卡住的地方。我是否必须在单个表单上使用子表单?
答案 0 :(得分:1)
你的行来源需要这样的东西:
Listbox1: SELECT id, category FROM categorytable
Listbox2: SELECT id, subcategory FROM subcategorytable
WHERE categoryID = Forms!NameOfForm!LListbox1
Listbox3: SELECT id, subsubcategory FROM subsubcategorytable
WHERE subcategoryID = Forms!NameOfForm!LListbox2
在表单的当前事件和listbox1和listbox2的更新后事件中,您需要根据需要重新查询listbox2和listbox3。