referential integrity and lookup

B

buggirl

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
 
J

Jeff Boyce

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.
 
J

John W. Vinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top