Microsoft KB Archive/209021

= ACC2000: Null Value Does Not Pass Validation Rule =

Article ID: 209021

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q209021



Novice: Requires knowledge of the user interface on single-user computers.

This article applies only to a Microsoft Access database (.mdb).



SYMPTOMS
If a field has a validation rule and you leave the field blank (or Null) in a table's Datasheet view, you may be unable to save the record.



CAUSE
This behavior occurs when you add a new record with two fields, one of which has a data type of AutoNumber. The record cannot be saved until it has received some input.



RESOLUTION
Include "Or Is Null" as part of the validation rule for the field. For example, a validation rule for a text field can be:

"A" Or "B" Or Is Null



Steps to Reproduce Behavior
  Create the following new table and save it as Table1:   Table: Table1 ---  Field Name: ID      Data Type: AutoNumber Field Name: Code Data Type: Text Validation Rule: "A" Or "B" Or Is Null  View the table in Datasheet view. Select the Code field. Type A and press ENTER.

Note that you can move to the next record. In the next record, press TAB to move to the third record.

Note that you cannot move to the next record because the Code field cannot initially be Null. The only user-input field in this table must receive some data before the record can be accepted. Select the Code field in the second record. Type A and press ENTER. Delete the "A" from the field, and press TAB.

Note that you can move to the next record now because the record was initially saved with data.</li></ol>

<div class="references_section">