无法添加或更改记录,因为需要相关记录 [英] cannot add or change a record because a related record is required
问题描述
我有一个带有组合框的子窗体,它不会添加记录。表单'的记录源是tblRetreadDetails。
I have a subform with a combo box that will not add a record. The form''s record source is tblRetreadDetails.
推荐答案
这意味着在记录您正在编辑字段[tblRetreadDetails]![RetreadOptionsID]要么没有设置值,要么您选择的值无效。鉴于只有有效值显示,那么它是控件中的设置 - 很可能是绑定列。
返回到您的CBO并确保BOUND列设置为包含[tblRetreadOptions]的列![RetreadOptionsID]
What this means is that in the record you are editing the field [tblRetreadDetails ]![RetreadOptionsID] either doesn''t have a value set or the value you have selected is not a valid. Given that only the valid values are showing then it''s a setting in the control - most likely the bound column.
Go back into your CBO and make sure the BOUND column is set for the column that contains the [tblRetreadOptions]![RetreadOptionsID]
绑定列为1.列数为5.列宽为0" ;; 1" 1" ;; 0" 0" ;。我正在使用第4列和第5列填充其他控件AfterUpdate。限制列表设置为是。
我在这个设置中看不到任何不同于我拥有的其他设置。
The bound column is 1. Column count is 5. Column widths are 0";1";1";0";0". I''m using columns 4 and 5 to populate other controls AfterUpdate. Limit To List is set to yes.
I''m unable to see anything different in the settings for this one than in numerous others I have.
请检查:
Please check:
[tblRetreadDetails]![RetreadOptionsID]
数字,tblRetreadOptions的外键
[tblRetreadDetails]![RetreadOptionsID]
Number, foreign key to tblRetreadOptions
在数据库工具,表关系中验证这一点
verify this in database tools, table relationships
组合的控制源是
RetreadOptionsID 。
The combo''s control source is
RetreadOptionsID.
验证这是[tblRetreadDetails]![RetreadOptionsID]
和NOT [tblRetreadOptions]![RetreadOptionsID]
(我倾向于将字段命名为..
tbl_exampletable
[exampletable_pk]
[exampletable_FK_relatedtable_pk]
或者
[exampletable_FK_relatedtable]
我学会了在多个表中不使用相同字段名称的困难;因此即使我使用[PK]或[ID]在每个表中,它总是以表名开头。花了两个星期的时间来弄清楚嵌入式查询为什么会出现故障并且我引用了错误的表/字段。
verify that this is [tblRetreadDetails]![RetreadOptionsID]
and NOT [tblRetreadOptions]![RetreadOptionsID]
(I tend to name fields with..
tbl_exampletable
[exampletable_pk]
[exampletable_FK_relatedtable_pk]
or
[exampletable_FK_relatedtable]
I learned the hardway to not use the same field name in multiple tables; thus even if I use [PK] or [ID] in every table it''s always prefaced with the table name. Took me two weeks to figure out why an embedded query kept failing and I had the wrong table/field referenced.
组合'的行源是:
[tblRetreadOptions]![RetreadOptionsID]
The combo''s rowsource is:
[tblRetreadOptions]![RetreadOptionsID]
verfiy这个实际上是在绑定列中设置的值...容易,临时设置宽度从0; 1; 1; 0; 0到全1,以便您可以看到第一个值。
verfiy that this is actually the value being set in the bound column... easy, temporarily set widths from 0;1;1;0;0 to all 1" so that you can see the first value.
这篇关于无法添加或更改记录,因为需要相关记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!