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  

referential integrity and lookup



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2010, 07:48 PM posted to microsoft.public.access.tablesdbdesign
buggirl
external usenet poster
 
Posts: 52
Default referential integrity and lookup

Hi all,

I want to enforce referential integrity between two fields in two separate
tables:

tbl FishTaxonomy (includes the full name, common name, and abbreviated
scientific name)
tb Fish (includes the abbreviated scientific name, length of each fish, sex,
etc.)

The name used in tbl Fish is from a lookup of tbl FishTaxonomy. However,
when I look at my relationships, there is no link between these two tables. I
try to join these fields and enforce referential integrity (I only want to
have one taxonomic description for each fish species, but lots of individuals
of each species). I get this error message:

No unique index found for the referenced field of the primary table.

I'm assuming that tbl FishTaxonomy is the primary table.

Also, the Edit Relationships box lists the relationship as 'indeterminate'.

Eek. I think there is something wrong with my design!

Help?

Thanks,

buggirl
  #2  
Old April 29th, 2010, 08:12 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default referential integrity and lookup

When you described your two tables, you didn't indicate what field(s) you
are using as a primary key in each.

A primary key serves to identify each unique record (so if your "abbreviated
scientific name" field is truly unique, that seems like a good candidate).

Then, after your Taxonomy table has a primary key identified, you'll need to
have a corresponding "foreign" key in your Fish table. This field holds a
copy of the value that points back to the primary key in the related table.

It isn't entirely clear from your description, but I suspect that you have:

* a taxonomy (i.e., a naming table)
* a list of examples (i.e., specific instances, each with a unique
"parent" from the taxonomy table)

If this is accurate, you have a one-to-many (or parent-child) relationship.
If one Taxonomy record could have many Fish examples, you have this kind of
relationship.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.


"buggirl" wrote in message
...
Hi all,

I want to enforce referential integrity between two fields in two separate
tables:

tbl FishTaxonomy (includes the full name, common name, and abbreviated
scientific name)
tb Fish (includes the abbreviated scientific name, length of each fish,
sex,
etc.)

The name used in tbl Fish is from a lookup of tbl FishTaxonomy. However,
when I look at my relationships, there is no link between these two
tables. I
try to join these fields and enforce referential integrity (I only want to
have one taxonomic description for each fish species, but lots of
individuals
of each species). I get this error message:

No unique index found for the referenced field of the primary table.

I'm assuming that tbl FishTaxonomy is the primary table.

Also, the Edit Relationships box lists the relationship as
'indeterminate'.

Eek. I think there is something wrong with my design!

Help?

Thanks,

buggirl



  #3  
Old April 30th, 2010, 08:47 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default referential integrity and lookup

On Thu, 29 Apr 2010 11:48:04 -0700, buggirl
wrote:

Hi all,

I want to enforce referential integrity between two fields in two separate
tables:

tbl FishTaxonomy (includes the full name, common name, and abbreviated
scientific name)
tb Fish (includes the abbreviated scientific name, length of each fish, sex,
etc.)

The name used in tbl Fish is from a lookup of tbl FishTaxonomy. However,
when I look at my relationships, there is no link between these two tables. I
try to join these fields and enforce referential integrity (I only want to
have one taxonomic description for each fish species, but lots of individuals
of each species). I get this error message:


Is the "abbreviated scientific name" unique in tblFishTaxonomy - i.e. if you
have an entry for STrutta in one record, is that the ONLY record with that
name? If so you could make the abbreviated name the Primary Key of
tblFishTaxonomy. I'd be inclined to use the ITIS TSN (http://www.itis.gov)
or some other widely accepted taxonomic unique key, though! No point in
reinventing a tool that already exists!

In any case you need either a Primary Key or (bad second best) a unique index
as the linking field.

I'd also strongly urge that you examine the use of Lookup Fields in your
tblFish: see http://www.mvps.org/access/lookupfields.htm for a critique of
what many consider a misfeature.
--

John W. Vinson [MVP]
 




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 11:40 AM.


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