Access 2007约束条款中的奇怪错误

时间:2012-02-09 19:36:20

标签: database-design ms-access ms-access-2007

Relationship must be on the same number of fields with the same data types. (Error 3368)
The CONSTRAINT clause you are using to create a relationship includes a different number of fields for each table or includes fields with different data types. Check the number of fields in the CONSTRAINT clause, check the data types of fields to make sure they match, and try again.

我以前从未遇到过这个问题。我有两个表,它们之间只有一对一的关系。我将自己的主键从一个表指定到另一个表。它们都是相同的数据类型(数字)。如果一个表的字段多于另一个表,为什么重要?这似乎只在我分配自己的主键时发生。 'many'表被索引(没有重复)。我已经尝试了所需的,而不是'one'表所要求的。是什么赋予了?无论参考价值多少,我都不允许任何参照完整性。

1 个答案:

答案 0 :(得分:2)

小数和整数不被视为等效数字类型。您必须将CountryPK更改为Long Integer或将CountryFK更改为Decimal。您也可以在两者上使用Double。