RSS Forums RSS
Please support our MS Access and FileMaker Pro advertiser: Programming Forums
Views: 6957 | Replies: 15
Reply
Join Date: Oct 2005
Posts: 17
Reputation: JC_2000 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
JC_2000 JC_2000 is offline Offline
Newbie Poster

Problem with Composite Key in MS Access

  #1  
Apr 14th, 2006
Hi,

I have a composite in a Microsoft Access Database that is not populating, when I add data to the two tables connected to it you would expect the Composite Key to populate as well wouldn't you? But this is not happening, can anyone expalain why and how this problem can be over come, keep in mind its an MS Access database as I know SQL DBs act differently with composite keys.

Please Help,

Jay.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2005
Location: Dallas, TX
Posts: 482
Reputation: campkev is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Problem with Composite Key in MS Access

  #2  
Apr 20th, 2006
do you mean a composite key or a computed field?
Reply With Quote  
Join Date: Oct 2005
Posts: 17
Reputation: JC_2000 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
JC_2000 JC_2000 is offline Offline
Newbie Poster

Re: Problem with Composite Key in MS Access

  #3  
Apr 20th, 2006
Thanks for replaying to my post as need all the help. I'm not sure what computed field is ? but I am sure the that this problem is a composite key.

You see what I have done is originally I had a many-to-many relationship but needed to sort (access doesn't like many-to many realtionships) this out so I put a Composite key between the two tables in the many-to-many relationship and this composite key has the just the primary keys of the two tables in it but the problem is that when I add data to the two related tables the composite key doesn't populate.

Is there anyway to do this? Maybe just do it with a form or anotherway? any ideas?

Anyone?

Jay.
Reply With Quote  
Join Date: Jul 2005
Location: Dallas, TX
Posts: 482
Reputation: campkev is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Problem with Composite Key in MS Access

  #4  
Apr 20th, 2006
sorry, but you are going to have to give me some details about how your tables are setup. does it look something like this?

table cars
CarID number
CarName vtext

table parts
PartID number
PartName text

table CarParts
CarID number
PartID number
Reply With Quote  
Join Date: Oct 2005
Posts: 17
Reputation: JC_2000 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
JC_2000 JC_2000 is offline Offline
Newbie Poster

Re: Problem with Composite Key in MS Access

  #5  
Apr 21st, 2006
Yes that is exactly right - with the carparts table acting as the composite with only the primary keys inside, nothing else.
Reply With Quote  
Join Date: Oct 2005
Posts: 17
Reputation: JC_2000 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
JC_2000 JC_2000 is offline Offline
Newbie Poster

Re: Problem with Composite Key in MS Access

  #6  
Apr 21st, 2006
So is it possible to make that table (carparts table) populate with data, as entries are added to the two connected tables (parts table & car table)?

If so how is this done or is there an alternative way?
Reply With Quote  
Join Date: Jul 2005
Location: Dallas, TX
Posts: 482
Reputation: campkev is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Problem with Composite Key in MS Access

  #7  
Apr 21st, 2006
ok, so you put entries in the cars table and entries in the parts table and then entries in the CarParts table to link them. Which table is having the problem?
Reply With Quote  
Join Date: Oct 2005
Posts: 17
Reputation: JC_2000 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
JC_2000 JC_2000 is offline Offline
Newbie Poster

Re: Problem with Composite Key in MS Access

  #8  
Apr 21st, 2006
The tables do have a link (relationship) between them, the question is, is it possible to make the carparts table populate with the primary keys (carID & PartID) when entries are added to the car table and parts tables?
Reply With Quote  
Join Date: Jul 2005
Location: Dallas, TX
Posts: 482
Reputation: campkev is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Problem with Composite Key in MS Access

  #9  
Apr 21st, 2006
i'm confused. what do you want it to populate with?
are you trying to have it do something like
you add
partid = 567, name = carburetor
and
carid = 256, name = chevy
at the same time and then the carparts table will automatically have
partid = 567, carid = 256 automatically added?
Reply With Quote  
Join Date: Oct 2005
Posts: 17
Reputation: JC_2000 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
JC_2000 JC_2000 is offline Offline
Newbie Poster

Re: Problem with Composite Key in MS Access

  #10  
Apr 21st, 2006
Yes that is correct. Can it be done?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:30 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC