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  

2 tables with referential integrity



 
 
Thread Tools Display Modes
  #1  
Old April 30th, 2009, 06:07 PM posted to microsoft.public.access.tablesdbdesign
Jacquie
external usenet poster
 
Posts: 30
Default 2 tables with referential integrity

I have 2 tables with referential integrity: contacts and orgs. it's a
many-to-one, with many contacts connected to one org. however, I also have
some contacts with no org, but when I try to add them, access tells me I have
to have an org to proceed. BUT THERE IS NO ORG!! org is not required in the
contacts table. what do I have to do? Thanks!!
  #2  
Old April 30th, 2009, 08:02 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 2 tables with referential integrity

Jacquie

I believe that if you tell Access to enforce referential integrity between
those two, you're telling it that you cannot have a Contact record without a
corresponding Org record.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Jacquie" wrote in message
...
I have 2 tables with referential integrity: contacts and orgs. it's a
many-to-one, with many contacts connected to one org. however, I also have
some contacts with no org, but when I try to add them, access tells me I
have
to have an org to proceed. BUT THERE IS NO ORG!! org is not required in
the
contacts table. what do I have to do? Thanks!!



  #3  
Old April 30th, 2009, 08:03 PM posted to microsoft.public.access.tablesdbdesign
Noëlla Gabriël
external usenet poster
 
Posts: 79
Default 2 tables with referential integrity

Hi,

the referential integrity dictates that you cannot have a contact without an
org. A much used solution is to create an org named "Private" or "No
organisation" and link all contacts without org to that one.
--
Kind regards
Noëlla


"Jacquie" wrote:

I have 2 tables with referential integrity: contacts and orgs. it's a
many-to-one, with many contacts connected to one org. however, I also have
some contacts with no org, but when I try to add them, access tells me I have
to have an org to proceed. BUT THERE IS NO ORG!! org is not required in the
contacts table. what do I have to do? Thanks!!

  #4  
Old April 30th, 2009, 09:52 PM posted to microsoft.public.access.tablesdbdesign
Fred
external usenet poster
 
Posts: 1,451
Default 2 tables with referential integrity

One could argue that Access referential integrity is not appropriate for this
set of tables. After all, it does nothing more than say"a contact can not
exist without an organization" which directly conflicts with the real world
situation that you are databasing.
  #5  
Old April 30th, 2009, 10:22 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 2 tables with referential integrity

I agree with Fred -- if the real world doesn't fit, don't shoehorn it in!
Adjust the system to match the scenario.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Noëlla Gabriël" wrote in message
...
Hi,

the referential integrity dictates that you cannot have a contact without
an
org. A much used solution is to create an org named "Private" or "No
organisation" and link all contacts without org to that one.
--
Kind regards
Noëlla


"Jacquie" wrote:

I have 2 tables with referential integrity: contacts and orgs. it's a
many-to-one, with many contacts connected to one org. however, I also
have
some contacts with no org, but when I try to add them, access tells me I
have
to have an org to proceed. BUT THERE IS NO ORG!! org is not required in
the
contacts table. what do I have to do? Thanks!!



  #6  
Old April 30th, 2009, 11:06 PM posted to microsoft.public.access.tablesdbdesign
Graham Mandeno
external usenet poster
 
Posts: 593
Default 2 tables with referential integrity

Hi Jacquie

Contrary to what the others have said, referential integrity does NOT
prevent a Null value is a foreign key field. It simply ensures that any
non-Null value in the FK field has a corresponding PK value in the one-side
table. (And, correspondingly, prevents you deleting a record in the one-side
table that has corresponding FK values on the many-side.)

My first suggestion would be to check that Org is not "Required" in the
contacts table, but it seems you have already verified that. I feel there
must be something else requiring that field to have a value. Is it perhaps
part of a required index (primary key maybe)?

Something else you could try is temporarily removing referential integrity
to verify that you can then add a record without an Org value. My guess is
that you will still not be able to.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand



"Jacquie" wrote in message
...
I have 2 tables with referential integrity: contacts and orgs. it's a
many-to-one, with many contacts connected to one org. however, I also have
some contacts with no org, but when I try to add them, access tells me I
have
to have an org to proceed. BUT THERE IS NO ORG!! org is not required in
the
contacts table. what do I have to do? Thanks!!



  #7  
Old April 30th, 2009, 11:41 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 2 tables with referential integrity

Thanks, Graham!

I haven't run across that variation, so your post satisfies my "what did you
learn new today?" requirement!

Jeff B.

"Graham Mandeno" wrote in message
...
Hi Jacquie

Contrary to what the others have said, referential integrity does NOT
prevent a Null value is a foreign key field. It simply ensures that any
non-Null value in the FK field has a corresponding PK value in the
one-side table. (And, correspondingly, prevents you deleting a record in
the one-side table that has corresponding FK values on the many-side.)

My first suggestion would be to check that Org is not "Required" in the
contacts table, but it seems you have already verified that. I feel there
must be something else requiring that field to have a value. Is it
perhaps part of a required index (primary key maybe)?

Something else you could try is temporarily removing referential integrity
to verify that you can then add a record without an Org value. My guess
is that you will still not be able to.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand



"Jacquie" wrote in message
...
I have 2 tables with referential integrity: contacts and orgs. it's a
many-to-one, with many contacts connected to one org. however, I also
have
some contacts with no org, but when I try to add them, access tells me I
have
to have an org to proceed. BUT THERE IS NO ORG!! org is not required in
the
contacts table. what do I have to do? Thanks!!





  #8  
Old April 30th, 2009, 11:56 PM posted to microsoft.public.access.tablesdbdesign
Graham Mandeno
external usenet poster
 
Posts: 593
Default 2 tables with referential integrity

You're welcome, Jeff!

I figure that day I don't learn something I must be dead :-)

Cheers,
Graham

"Jeff Boyce" wrote in message
...
Thanks, Graham!

I haven't run across that variation, so your post satisfies my "what did
you learn new today?" requirement!

Jeff B.

"Graham Mandeno" wrote in message
...
Hi Jacquie

Contrary to what the others have said, referential integrity does NOT
prevent a Null value is a foreign key field. It simply ensures that any
non-Null value in the FK field has a corresponding PK value in the
one-side table. (And, correspondingly, prevents you deleting a record in
the one-side table that has corresponding FK values on the many-side.)

My first suggestion would be to check that Org is not "Required" in the
contacts table, but it seems you have already verified that. I feel
there must be something else requiring that field to have a value. Is it
perhaps part of a required index (primary key maybe)?

Something else you could try is temporarily removing referential
integrity to verify that you can then add a record without an Org value.
My guess is that you will still not be able to.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand



"Jacquie" wrote in message
...
I have 2 tables with referential integrity: contacts and orgs. it's a
many-to-one, with many contacts connected to one org. however, I also
have
some contacts with no org, but when I try to add them, access tells me I
have
to have an org to proceed. BUT THERE IS NO ORG!! org is not required in
the
contacts table. what do I have to do? Thanks!!







  #9  
Old May 1st, 2009, 05:24 PM posted to microsoft.public.access.tablesdbdesign
Fred
external usenet poster
 
Posts: 1,451
Default 2 tables with referential integrity

Graham pointed out a possibility / way that it should work that I forgot
about.

My first guess on what to check if it isn't working is that if the FK is a
numeric field, to make sure that the default value for that field is null and
not zero.
  #10  
Old May 2nd, 2009, 12:14 AM posted to microsoft.public.access.tablesdbdesign
Graham Mandeno
external usenet poster
 
Posts: 593
Default 2 tables with referential integrity

Yes! Good thinking, Fred!

Jacquie seems to have left us, but it's an interesting discussion anyway :-)

--
Cheers,
Graham M

"Fred" wrote in message
...
Graham pointed out a possibility / way that it should work that I forgot
about.

My first guess on what to check if it isn't working is that if the FK is a
numeric field, to make sure that the default value for that field is null
and
not zero.



 




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:46 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.