A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Multiple instances of product in one order.



 
 
Thread Tools Display Modes
  #1  
Old March 22nd, 2010, 08:19 PM posted to microsoft.public.access.tablesdbdesign
lap
external usenet poster
 
Posts: 3
Default 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  
Old March 22nd, 2010, 10:46 PM posted to microsoft.public.access.tablesdbdesign
Fred
external usenet poster
 
Posts: 1,451
Default 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  
Old March 23rd, 2010, 03: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.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.