Table of contents
TOC
折叠目录
展开目录

该字段不能包含 Null 值,因为此字段所必需的属性设置为 True。The field cannot contain a Null value because the Required property for this field is set to True.在此字段中输入一个值。Enter a value in this field.(错误 3314)(Error 3314)

office 365 dev account|上次更新日期: 2018/4/3
|
2 参与人员

适用于: Access 2013 | Access 2016Applies to: Access 2013 | Access 2016

本文在空值是什么?所必需的属性是什么?解决方案中删除必需的属性设置允许空字符串属性In this articleWhat Is a Null?What Is the Required Property?SolutionTo remove the required propertySetting the AllowZeroLength Property

此字段的必填属性设置为,则禁止输入Null或零长度字符串 ("") 字段中。The Required property for this field is set to Yes, prohibiting the entry of a Null or zero-length string (" ") in the field.在字段中输入一个值。Enter a value in the field.

何谓 Null?What Is a Null?

Null是您可以在字段中输入或用于表达式和查询,以标明丢失或未知数据的值。A Null is a value you can enter in a field or use in expressions or queries to indicate missing or unknown data.在 Microsoft Visual Basic 中, Null关键字指示一个Null值。In Microsoft Visual Basic, the Null keyword indicates a Null value.某些字段,如主键字段不能包含空值Some fields, such as primary key fields, cannot contain Null.

什么是 Required 属性?What Is the Required Property?

必填属性用于指定是否在字段中要求一个值。You can use the Required property to specify whether a value is required in a field.如果此属性设置为,在某条记录中输入数据时,您必须输入一个值的字段或任何绑定到字段,并且该值不能为If this property is set to Yes, when you enter data in a record, you must enter a value in the field or in any control bound to the field, and the value cannot be Null.例如,您可能希望确定每条记录的 LastName 控件都有相应的值。For example, you might want to be sure that a LastName control has a value for each record.

解决方案Solution

此问题可能的解决方案如下所述:This problem has the following possible solutions:

  • 在错误消息中指定的字段中输入值。Enter a value in the field named in the error message.

  • 从字段中删除必需的属性设置。Remove the Required property setting from the field.

  • 使用允许空字符串属性以允许零长度字符串 ("") 来存储在字段中。Use the AllowZeroLength property to allow zero-length strings (" ") to be stored in the field.

删除 Required 属性To remove the required property

  1. 在导航窗格中,右键单击包含所需的字段的表的名称,然后单击设计视图In the Navigation Pane, right-click the name of the table that contains the required field, and then click Design View.

  2. 单击错误消息中指定的字段的字段名称Click the Field Name for the field named in the error message.

  3. 字段属性中,单击常规选项卡。Under Field Properties, click the General tab.

  4. 必需属性中,单击In the Required property, click No.

  5. 若要保存所做的更改,请单击快速访问工具栏上的保存或按 CTRL + S。To save your changes, click Save on the Quick Access Toolbar, or press CTRL+S.

设置 AllowZeroLength 属性Setting the AllowZeroLength Property

可以使用所需允许空字符串属性以区分不存在的信息 (存储为一个零长度字符串 ("") 在字段) 和可能存在但未知 (存储为Null值的信息字段)。You can use the Required and AllowZeroLength properties to differentiate between information that does not exist (stored as a zero-length string (" ") in the field) and information that may exist but is unknown (stored as a Null value in the field).如果将 AllowZeroLength 属性设置为"是",则零长度字符串将成为该字段的有效输入,与 Required 属性的设置无关。If you set the AllowZeroLength property to Yes, a zero-length string will be a valid entry in the field regardless of the Required property setting.如果将需要设置为允许空字符串,必须在字段中,输入值和零长度字符串不会有效的条目。If you set Required to Yes and AllowZeroLength to No, you must enter a value in the field, and a zero-length string will not be a valid entry.

下表显示了当组合所需允许空字符串属性的设置可以期望的结果。The following table shows the results you can expect when you combine the settings of the Required and AllowZeroLength properties.

RequiredRequired允许空字符串AllowZeroLength用户的操作User's action存储值Value stored
NoNo按输入按下空格键输入一个零长度字符串Presses ENTER Presses SPACEBAR Enters a zero-length string为空为空(不允许)NullNull (not allowed)
NoYes按输入按下空格键输入一个零长度字符串Presses ENTER Presses SPACEBAR Enters a zero-length string为空为空零长度字符串NullNull Zero-length string
YesNo按输入按下空格键输入一个零长度字符串Presses ENTER Presses SPACEBAR Enters a zero-length string(不允许)(不允许)(不允许)(not allowed) (not allowed) (not allowed)
YesYes按输入按下空格键输入一个零长度字符串Presses ENTER Presses SPACEBAR Enters a zero-length string(不允许)零长度字符串的长度为零的字符串(not allowed) Zero-length string Zero-length string

访问支持资源ACCESS SUPPORT RESOURCES
访问 MSDN 上的开发人员论坛Access for developers forum on MSDN
访问 support.office.com 上的帮助Access help on support.office.com
访问 answers.microsoft.com 上的帮助Access help on answers.microsoft.com
在必应上搜索特定的访问错误代码Search for specific Access error codes on Bing
访问 UtterAccess 上的论坛Access forums on UtterAccess
访问 UtterAcess 上的 wikiAccess wiki on UtterAcess
访问开发人员和 VBA 编程帮助中心 (FMS)Access developer and VBA programming help center (FMS)
访问 StackOverflow 上的帖子Access posts on StackOverflow

© 2018 Microsoft