Link to home
Start Free TrialLog in
Avatar of J G
J G

asked on

Access table Index ignoring Nulls when set to No

I have a 3 field table index:

PLU
Vendor_Name
Order_Code

Index Properties:

Primary - No
Unique - Yes
Ignore Nulls - No

I am still able to create duplicate records in the table when Order_Code field is unpopulated/blank.  If I enter a duplicate order_code value (lets say "01"), the index works, and will not allow me to create the record.

Why isn't the index working when I leave the field blank?
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of J G
J G

ASKER

I still want the ability to create a single record with a null value in the Order_Code field.  When I try now, Access is returning "You must enter a value in the tbl_Vendor_Item.Order_Code Field.
Allowing null in a field that is part of a unique index is handled differently by various RDBMS.  If this field is a string, you can set the AllowZLS property to Yes and that will allow you to store one "blank" value.  If the field is numeric and is not a foreign key, you can use some arbitrary high or low value but your queries will have to always interpret that value.  I would need to understand more about the purpose of the field and why null is a valid value to offer more concrete suggestions.