I tried setting up a relationship although I don't know if this is how I'm meant to do it:
我尝试建立一段关系虽然我不知道这是不是我的意思:
Category column settings:
类别列设置:
Description column settings:
说明列设置:
Linked to the table that contains different type of furniture, "Furniture":
链接到包含不同类型家具的桌子,“家具”:
Furniture design:
家具设计:
So what I want to do, is make it so that when you choose a furniture category, you can only choose from furniture descriptions of that category:
1 个解决方案
#1
1
I do not think this can be done using only tables — you'll have to create a form that will limit the selection in the descriptions listbox based on the category.
我不认为只能使用表来完成 - 您必须创建一个表单,根据类别限制描述列表框中的选择。
Also, there are a number of problems with your data structure:
此外,您的数据结构存在许多问题:
- I imagine multiple
Furniture
s can have the sameCATEGORY
. This means thatCATEGORY
cannot be the primary key -- a uniquely identifying piece of data -- forFurniture
. I would suggest adding a Long number column calledFurnitureID
. If you make this an Autonumber column, every new record will get a new number by default; otherwise you'll have to insert the number by hand. - 我想多个家具可以有相同的CATEGORY。这意味着CATEGORY不能成为Furniture的主键 - 唯一标识数据。我建议添加名为FurnitureID的长号列。如果您将其设为自动编号列,则默认情况下每个新记录都将获得一个新数字;否则你必须手动插入号码。
- Once you have such a column, you should have a corresponding column — AKA the foreign key column — in
Stock
of the same type (or Long if theFurnitureID
is an Autonumber). These two columns should be related in the Relationships window. The relationship means that every1Stock
record must have a relatedFurniture
record with the same data in both records. - 一旦你有这样一个列,你应该有一个相应的列 - AKA外键列 - 相同类型的库存(如果FurnitureID是自动编号,则为Long)。这两列应该在Relationships窗口中相关。这种关系意味着每1股票记录必须具有相关的家具记录,两个记录中的数据相同。
- Once you've done that, there is no need to repeat the
CATEGORY
andDESCRIPTION
fields between theStock
andFurniture
tables. This means no duplicate data, and no potential conflicts. - 完成后,无需重复Stock和Furniture表之间的CATEGORY和DESCRIPTION字段。这意味着没有重复数据,也没有潜在的冲突。
1. Depending on how the column is defined, it might be possible to have no data in the foreign key column in the Stock
record; but this is relatively uncommon
1.根据列的定义方式,可能在Stock记录的外键列中没有数据;但这种情况相对不常见
#1
1
I do not think this can be done using only tables — you'll have to create a form that will limit the selection in the descriptions listbox based on the category.
我不认为只能使用表来完成 - 您必须创建一个表单,根据类别限制描述列表框中的选择。
Also, there are a number of problems with your data structure:
此外,您的数据结构存在许多问题:
- I imagine multiple
Furniture
s can have the sameCATEGORY
. This means thatCATEGORY
cannot be the primary key -- a uniquely identifying piece of data -- forFurniture
. I would suggest adding a Long number column calledFurnitureID
. If you make this an Autonumber column, every new record will get a new number by default; otherwise you'll have to insert the number by hand. - 我想多个家具可以有相同的CATEGORY。这意味着CATEGORY不能成为Furniture的主键 - 唯一标识数据。我建议添加名为FurnitureID的长号列。如果您将其设为自动编号列,则默认情况下每个新记录都将获得一个新数字;否则你必须手动插入号码。
- Once you have such a column, you should have a corresponding column — AKA the foreign key column — in
Stock
of the same type (or Long if theFurnitureID
is an Autonumber). These two columns should be related in the Relationships window. The relationship means that every1Stock
record must have a relatedFurniture
record with the same data in both records. - 一旦你有这样一个列,你应该有一个相应的列 - AKA外键列 - 相同类型的库存(如果FurnitureID是自动编号,则为Long)。这两列应该在Relationships窗口中相关。这种关系意味着每1股票记录必须具有相关的家具记录,两个记录中的数据相同。
- Once you've done that, there is no need to repeat the
CATEGORY
andDESCRIPTION
fields between theStock
andFurniture
tables. This means no duplicate data, and no potential conflicts. - 完成后,无需重复Stock和Furniture表之间的CATEGORY和DESCRIPTION字段。这意味着没有重复数据,也没有潜在的冲突。
1. Depending on how the column is defined, it might be possible to have no data in the foreign key column in the Stock
record; but this is relatively uncommon
1.根据列的定义方式,可能在Stock记录的外键列中没有数据;但这种情况相对不常见