Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old September 9th, 2003, 09:59 AM
Reg010 Reg010 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 1 Reg010 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face Foreign key linked to primary key-not updating

Hello!
I am working on an Access DB and I am fairly new to it. I have a Master table with a primary key called (CustID) which links to an invoicedetail table with a foreign key of (CustID). On my subform, when I enter the invoice details it is not updating the foreign key field so I get a message "You can't add or change a record because a related record is required in the Customer Master table. What do I need to do to get the foreign key field to update the data from the primary key.

Any help would be greatly appreciated!

Reply With Quote
  #2  
Old September 11th, 2003, 08:52 AM
saxtonj saxtonj is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 11 saxtonj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 32 sec
Reputation Power: 0
I think you may be expecting a little too much from a database constraint relationship.

All the foreign key does is create a link between 2 tables.

You have to programatically keep the link in place. You cant say add a set of values to table b and expect the database to create a corresponding record in table A.

You have to first create your record in table A thereby creating a new CUSTID. Then create your table B record using the newly created CUSTID as the foreign key.

Now you use the foreign key constraint to maintain a link between the 2 tables.

Thereofre if you were to look up the dat you could in theory say


select * from tableA a, TableB b where a.CUSTID = 123 and b.CUSTID = a.CUSTID

hope this makes some sense to you.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Foreign key linked to primary key-not updating


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway