Hi, Allen:
Thanks for taking the time to reply.
Perhaps it would help if I explained the logic behind my program. I am
making a Contact database filled with people who are selling their homes
on
their own.
My table A is really my [Addresses] table.
My table C is really my [Phone Numbers] table
Table B is my junction.
I know your next question: Why wouldn't you put this information together
in
the same table?
The answer is: Because I might not know both pieces of information at the
same time; I might never know both pieces. If the info was in the same
table
there would be a lot of wasted spaces due to empty fields. I'm trying to
avoid that.
I need a table of Numbers for when I will contact the seller by phone
(when
that's all that I have). I need another table for addresses to which I
will
send a letter. When I discover that a Number that is known to me is
associated with an Address that I've just discovered, I need to relate
these
two pieces of info in my junction table.
For example, I read in the newspaper that a home is for sale. The Phone
Number is in the ad but the street address is not. So, I record the Phone
Number and call the person after I'm done collecting phone numbers for the
day. Days later, I drive by a home that has a For Sale sign in front of
it.
On the sign is a Phone Number and I know the street address because I'm
right
in front of the house. Now, I take these two pieces of information home
with
me and enter them into my Access form. Since the street address was not
previously known to me, my program writes it to the [Addresses] table.
When
the program processes the Phone Number, it detects that the Number was
already known to me and must now associate that Number with the new
Address
(in my junction table). Since I already called the seller on the phone
days
ago, this functionality will save me the expense of creating a letter and
paying postage for a seller I've already contacted.
This senario could happen vice-versa, also. I could know the address first
and discover the Phone Number days later.
Also, I might have an Address and NEVER discover the Phone Number and
vice-versa.
I need to be able to delete an Address and have the Phone Number and
junction record be deleted, also. And I need to be able to delete a Phone
Number and have the other two records delete with it.
Any ideas? Thanks!
Chris Smith
Allen Browne said:
You cannot do that with relationships, becuase there is no direct
relationship between tables A and C.
Taking Northwind as an example, we will use the Orders as A, [Order
Details]
as B, and Products as C.
When you delete an order, it makes sense to delete the Order Details as
well. But what would it mean to delete all the products in the related
Order
Details? What would you expect to happen to *other* orders that also
refer
to those products?
Hello.
I have a many-to-many relationship using table A and table C. Table B
is
my
junction table.
A <-> B <-> C
I am able to delete a record from A and have the related records from B
delete, also.
I am able to delete a record from C and have the related records from B
delete, also.
What I would like to have happen is: delete a record from A and have
the
related records from B *AND* C be deleted. Also, I would like to delete
a
record from C and have the related records from B *AND* A be deleted.
Can this be done through relationships? Is there any non-VBA way to
accomplish this?
Thank you for your time!
Chris Smith