View Single Post
  #3  
Old March 23rd, 2010, 02:57 AM posted to microsoft.public.access.tablesdbdesign
Allen Browne
external usenet poster
 
Posts: 11,706
Default Multiple instances of product in one order.

As you found, the Order Details table in Northwind has a primary key
consisting of 2 fields in combination: OrderID + ProductID. I suspect
Microsoft did this just as an example of a complex primary key, but it does
have the limitation you pointed out.

To solve it, open the Order Details table in design view, and add another
field like this:
OrderDetailID AutoNumber
Mark it as the primary key.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"LAP" wrote in message
news
For an example, I have been using MS Northwind example. One problem I have
run into is adding the same item twice in an order. I am keeping track of
time in my database. For instance, Project1 might be from 8:00AM to 12PM,
then Project2 from 12PM to 3PM, then Project1 again from 3PM to 5PM.

If you try to add the same product in the sample Northwind database, it
comes up with the same error. I know the reason it is coming up is because
it
has to have its own primary key and cannot duplicate. How should I go
around
this so I can add the same "product" in the same order?

Thanks for any comments.