If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
Multiple instances of product in one order.
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. |
#2
|
|||
|
|||
Multiple instances of product in one order.
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. |
#3
|
|||
|
|||
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. |
Thread Tools | |
Display Modes | |
|
|