Solved

Troubleshooting referential integrity

Posted on 2008-06-17
3
200 Views
Last Modified: 2013-11-28
Table A                                      Table B
pkFieldOne     Text     1>>>M    fkFieldOne     Text
pkFieldTwo    Test      1>>>M   fkFiledTwo     Text
9000 records              7000 records

Not all records need to reside in Table B   just all 7000 records need to relate to Table A
Access 2000/2003   recognizes the 1 to many relatiionship but it won't allow the setting of RI

I have ran two unmatching fields  One where pkFieldOne = fkFieldOne  and the other where pkFieldTwo = fkFieldTwo  fix the problems then tried to set RI and it still will not set.  I think I have unmatching groupings of fieldOnes and fieldTwos

I found this problem by the ability of adding data into TableB without any error messages.   This messes things up.  
How do I run one unmatching field query where it pkFieldOne = fkFieldOne  AND pkFieldTwo = fkFieldTwo?
0
Comment
Question by:Michael Janiszewski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 51

Accepted Solution

by:
Mark Wills earned 500 total points
ID: 21808732
OK, as a query, go into SQL view and paste the following

Select b.fieldone,b.fieldtwo from tableb b
left outer join tablea a on b.fieldone = a.fieldone and b.fieldtwo = a.fieldtwo
where a.fieldone is NULL;


basically what we are saying is from tableb join to tablea but (using left outer) we do not care if tablea has matching records. The "where" will select those rows where there is no tablea row that matches (because it will be NULL)
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21816200
MG_Janiszewski,

Just curious,

Why do you have two primary keys in the same table linked to two of the same foreign keys in a second table?

JeffCoachman
0
 

Author Comment

by:Michael Janiszewski
ID: 21818132
The whole database is centered around fieldOne and FieldTwo.  TableA is the Master table and Table B breaks additional information about the data in Table A.
0

Featured Post

Containers and Docker for Everyone

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question