数据输入表单中自动编号FK的问题 [英] problem with autonumber FK in data entry form
问题描述
你好,
当我尝试保存记录时,我有一个数据输入屏幕,它会给我以下错误。字段studentinfo.personid不能包含空值,因为必需属性设置为true。
这是有道理的,因为特定字段IS设置为必需。但它是来自自动编号的FK。
屏幕收集人员信息(地址等),学生信息(程序等),并将角色指定为默认值(学生) )。没有子表单,一切都在主表单上。
我的表单的记录源是:
Hello,
I have a data entry screen that is giving me the following error when I try to save a record."field studentinfo.personid cannot contain a null value because the required property is set to true."
this makes sense because the particular field IS set to required. but it is a FK from an autonumber.
the screen collects person information (addresses, etc), student information (programs, etc), and assigns a role as a default value (student). There are no subforms, everything is on main form.
My recordsource for the form is:
推荐答案
除非这些表具有一对一的关系(即每个表中只有一条记录对应于连接表中的记录),否则无法向此查询添加记录。
这意味着查询不可更新,您必须将表单拆分为主表单和子表单
Unless these tables have a one to one relationship (that is that there is one and only one record in each table corresponding to the record in the joined table) you cannot add a record to this query.
This means that the query is not updatable and you will have to split your form into main and subform(s)
除非这些表具有一对一关系(即每个表中只有一条记录对应于连接表中的记录),否则无法向此查询添加记录。 />
这意味着查询不可更新,您必须将表单拆分为主表单和子表单
Unless these tables have a one to one relationship (that is that there is one and only one record in each table corresponding to the record in the joined table) you cannot add a record to this query.
This means that the query is not updatable and you will have to split your form into main and subform(s)
是在我在帖子中写完所有内容后,我开始看到了这一点。使用子表单应该可以解决问题。但是,有问题的关系(人 - > studentinfo)确实应该是一对一的,但目前是一对多的。这有什么简单的解决方法吗?当以这种方式应用时,自动编号类型似乎不太灵活。
Yes I started to see that after I wrote everything out in the post. Using subforms should fix the problem. However, the relationship in question (person -> studentinfo) really SHOULD be a one-to-one but is currently one-to-many. Is there any easy fix to this? The autonumber type does not seem very flexible when applied this way.
是的,我在帖子中写完所有内容之后就开始看到了。使用子表单应该可以解决问题。但是,有问题的关系(人 - > studentinfo)确实应该是一对一的,但目前是一对多的。这有什么简单的解决方法吗?以这种方式应用时,自动编号类型似乎不太灵活。
Yes I started to see that after I wrote everything out in the post. Using subforms should fix the problem. However, the relationship in question (person -> studentinfo) really SHOULD be a one-to-one but is currently one-to-many. Is there any easy fix to this? The autonumber type does not seem very flexible when applied this way.
从studentinfo表中删除任何重复的personId记录。然后在studentinfo表设计中将personId的索引属性更改为Yes(No Duplicates)。
Delete any duplicate personId records from the studentinfo table. Then in the studentinfo table design change the indexed property of personId to Yes (No Duplicates).
这篇关于数据输入表单中自动编号FK的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!