Relationships

S

Slim

I'm trying to relate all my tables and I keep getting the
following message:
Index or primary key cannot contain a Null value
The following shows all tables and Primary Key (PK)
What am I doing wrong when I go to join the Orders and
OrderDetails tables?
Tables:
ORDERS - OrderNumber (PK), CustomerID, EmployeeID,
OrderType, OrderDate, OrderTotal, OrderDetailsNumber
ORDERDETAILS - OrderDetailsNumber (PK), OrderNumber,
ProductID, Quantity, CurrentPrice, Discount, LineAmount
PRODUCTS - ProductID (PK), ProductName,
ProductDescription, ProductCategory, UnitPrice,
UnitsinStock, ReOrderLevel
CUSTOMERS - CustomerID (PK), CompanyName,ContactLName,
ContactFName, Address, City, State, Postcode,
ContactTitle, PhoneNumber, FaxNumber, EmailAddress, Notes
EMPLOYEES - EmployeeID (PK), EmployeeSurname,
EmployeeGivenName, Address, Suburb, PhoneNumber, TFN,
StartDate, TerminationDate, YearlyBonus,
CurrentBonusPoints, Telemarketer

Any help would be much appreciated.
 
D

David Wilson

If the error occurs when you are trying to assign the field as the primary
key (upon saving), then that field has a blank (or "null") value in one or
more rows. There must be a value in each row. Ideally the _ID fields will
just be the autonumber type.

If the error occurs on trying to save the relationship update, it is
probably a missing row in the "one" side of the relationship. This is only
an issue where you are enforcing referential integrity. See "one-to-one"
and "one-to-many" relationships to learn more.
 
M

Marcelo Scofano Diniz

Hello,

at first glance, I saw no error.
So:
1) All of your tables are empty now?
2) All of your tables have yet no other index besides the PK?
3) The ORDERDETAILS.OrderNumber is a Foreign Key (FK) of ORDERS.OrderNumber.
So, ORDERDETAILS.OrderNumber is a long integer, is it?

If these assumptions are not true, try copy the database with empty tables
and associate them. If no more errors, a data error is catching you, like an
ORDERDETAILS.OrderNumber that not exists in ORDERS table

Good luck

Marcelo Scofano
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Database design check 1

Top