P
Peter Danes
I have a strange (to me, anyway) relationship setup that I haven't found
addressed in any of the forums, online help or any of my manuals. Of course,
maybe I'm just being dumb.
The basic structure tracks professional literature for a department's
internal library. There are three types of publications collected - books,
magazines and journals. There is one primary table for all the data which is
common to each type (archive number, physical location, date acquired...)
and a separate sub-table for each of the three types, containing data which
is unique to the type (books have an author, magazines do not...)
Originally I had a primary key in the main table using an autonumber field
and primary keys in the subtables using a compound key of consisting of the
autonumber from the main table as a standard doubleprecision number and
another autonumber field in the subtable. Access linked these up in three
one-to-many relationships and everything looked great.
Recently I realized that the autonumber fields in the subtables don't really
do anything for me, since each subtable can have either one or no records
for each record in the main table. That is, each piece of literature has
exactly one entry in the main table and exactly one entry in exactly one of
the three subtables. So carrying over the autonumber field from the main
table is enough to uniquely identify the record. With that in mind, I
removed the autonumber field from the subtables, leaving only the copy of
the autonumber from the main table as the primary key. The relationship
window still showed the links as one-to-many and everything I've written to
date still worked.
(Sorry to be so long-winded, but I want to make sure I explain this
properly.)
So here's the issue: When I delete such a relationship line, I can't put it
back as anything other than a one-to-one relationship. I don't want a strict
one-to-one, because for every main record, two of the three tables will have
no entry. But I'm leery of anything that smacks of witchcraft and a
relationship that can't be created without 'fooling' the table with a false
structure which is then removed again doesn't strike me as good practice.
Is this correct behavior for the relationship window or have I discovered
something weird? Can I set up a one-to-zero-or-one relationship somehow? I
assumed that my form would simply create one record on the many side of the
join and not address the fact that the structure could allow more than one.
Or have I made a fundamental mistake in the design somewhere?
Pete
P.S. I'll be out of the office until the weekend, at least.
This e-mail address is fake to keep spammers and their auto-harvesters out
of my hair. If you need to get in touch personally, I am 'pdanes' and I use
Yahoo mail. But please use the newsgroups whenever possible, so that all may
benefit from the exchange of ideas.
addressed in any of the forums, online help or any of my manuals. Of course,
maybe I'm just being dumb.
The basic structure tracks professional literature for a department's
internal library. There are three types of publications collected - books,
magazines and journals. There is one primary table for all the data which is
common to each type (archive number, physical location, date acquired...)
and a separate sub-table for each of the three types, containing data which
is unique to the type (books have an author, magazines do not...)
Originally I had a primary key in the main table using an autonumber field
and primary keys in the subtables using a compound key of consisting of the
autonumber from the main table as a standard doubleprecision number and
another autonumber field in the subtable. Access linked these up in three
one-to-many relationships and everything looked great.
Recently I realized that the autonumber fields in the subtables don't really
do anything for me, since each subtable can have either one or no records
for each record in the main table. That is, each piece of literature has
exactly one entry in the main table and exactly one entry in exactly one of
the three subtables. So carrying over the autonumber field from the main
table is enough to uniquely identify the record. With that in mind, I
removed the autonumber field from the subtables, leaving only the copy of
the autonumber from the main table as the primary key. The relationship
window still showed the links as one-to-many and everything I've written to
date still worked.
(Sorry to be so long-winded, but I want to make sure I explain this
properly.)
So here's the issue: When I delete such a relationship line, I can't put it
back as anything other than a one-to-one relationship. I don't want a strict
one-to-one, because for every main record, two of the three tables will have
no entry. But I'm leery of anything that smacks of witchcraft and a
relationship that can't be created without 'fooling' the table with a false
structure which is then removed again doesn't strike me as good practice.
Is this correct behavior for the relationship window or have I discovered
something weird? Can I set up a one-to-zero-or-one relationship somehow? I
assumed that my form would simply create one record on the many side of the
join and not address the fact that the structure could allow more than one.
Or have I made a fundamental mistake in the design somewhere?
Pete
P.S. I'll be out of the office until the weekend, at least.
This e-mail address is fake to keep spammers and their auto-harvesters out
of my hair. If you need to get in touch personally, I am 'pdanes' and I use
Yahoo mail. But please use the newsgroups whenever possible, so that all may
benefit from the exchange of ideas.