Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 673
  • Last Modified:

Index or Primary Key Cannot Contain A Null Value

See attached form frmPrices.

I cannot seem to add a record in here. I get the error;

"Index or Primary Key Cannot Contain A Null Value"

Why?
(It may have to do with my indexes on tblPrices??)
Database1.mdb
0
Patrick O'Dea
Asked:
Patrick O'Dea
3 Solutions
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Yes it does.  I made the AutoNumber the Primary Key - as it should be.

attached.
Database1-MX01.zip
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please check the table the form frmPrices is bound to.
that table has primary key and/or unique index(es) [which are not auto-number]
those fields cannot be null, so you need to check if the form sets values for all those fields [again: with exception of the field that is autonumber]
the error message tells you that you are missing (at least) one such field
0
 
Rey Obrero (Capricorn1)Commented:
you have three indexes in table tblPrice that does not allow null vlaues

CurrencyCode
PriceID
SupplierID
ProductCode
0
 
Patrick O'DeaAuthor Commented:
Thanks all!

I shouldl have spotted the error my self!
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Here is another version with a Unique Index on your original two fields that were the Primary Key before - in case that is what you need ... see attached and image.

mx
Database1-MX02.zip
Capture1.gif
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now