开发者

How to allow duplicate blanks in an Access index?

开发者 https://www.devze.com 2023-02-28 04:07 出处:网络
Using Access 2007.I have a field that I want to only have unique non-blank values, but allow multiple blank values.I tried setting an index with Unique: Yes and Ignore Nulls: Yes.I can manually enter

Using Access 2007. I have a field that I want to only have unique non-blank values, but allow multiple blank values. I tried setting an index with Unique: Yes and Ignore Nulls: Yes. I can manually enter records that have this field blank, but when I try to use SQL to insert a record that has a blank value for this field,开发者_如何学C e.g.

insert into mytable (field1, blanksOK, field3) values ("xyz","","123")

then Access gives me an error message: "...didn't add 1 record(s) to the table due to key violations..."

Changing Ignore Nulls from Yes to No doesn't seem to make any difference.

How can I make duplicate blanks allowable, but prevent duplicate non-blanks?


I was under the impression blanks are not valid for indexed keys in Access, hence the error. Keys must have non blank entries by definition. nulls are OK as described as null is an indexabe value.

0

精彩评论

暂无评论...
验证码 换一张
取 消