Multiple instances of product in one order.

L

LAP

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.
 
F

Fred

I've only glanced at Northwind, and I think that you'll have to give a more
detailed example, But it's design is for ability to do multiple sales of
the same product. Roughtly speaking, for duplicated sales of the same item,
you enter the item once in products, and multiple times in order details. It
sounds like this is slightly different than your business. If you give a
more detailed example, I think that we could suggest a way that you can make
Northwind work for you in this respect.
 
A

Allen Browne

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.
 

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

Top