J
Jeff Conrad
Hi,
Using Access 97 here.
I have a table of states with the following fields:
StateID - PK Autonumber
StateCode - Text - 2 digits
StateName - Text
(I realize an autonumber PK wasn't really needed since the
state codes and names are short, not duplicated, and
stable, but I made this quite a while ago)
Anyway, I have several 1-M relationships with other tables
in the database from tblStates.
One table of contacts (tblContacts) now has 2
relationships with this table. This is the first time I've
run into this situation so I wanted to make sure this is
the correct way to handle this scenario. I have
address/city/state information already in the table, but I
needed to have an alternate address/city/state as well.
Incidentally, I know that perhaps setting up a third table
of address information for a M-M relationship might be the
better road to go, but let me just stick with this for the
moment.
When I dragged the StateID field from tblStates to
tblContacts in the relationships window Access said
something like "A relationship already exists with this
table. Do you wish to edit that one?" I said No and a
tblStates_1 appeared in the window. I was then able to
make a relationship between this alias (???) table and
tblContacts.
So first question: Is this OK as far as the relationship
window is concerned? Will data integrity still be OK since
I checked enforce RI?
I ran into some problems with a query on tblContacts used
to generate contact reports. To be honest, I can't write
SQL all that well so I rely on playing in the Design View
until I get things just right. It works very well for me.
My troubles came if there was no information in the
alternate StateID field. The query would then return
nothing in the first state fields even if there was data
there! So lots of trial and error later with join lines I
was able, I think, to make it work by bringing a second
tblStates into the query design grid. Again it did a
tblStates_1 thing. I adjusted the join lines and
everything "seems" to be working fine. I get data
displayed properly whether there are empty fields or not.
So second question: Is it all right to have this "alias"
table in the query?? Am I screwing things up??
Thanks for any help,
Jeff Conrad
Access Junkie
Bend, Oregon
Using Access 97 here.
I have a table of states with the following fields:
StateID - PK Autonumber
StateCode - Text - 2 digits
StateName - Text
(I realize an autonumber PK wasn't really needed since the
state codes and names are short, not duplicated, and
stable, but I made this quite a while ago)
Anyway, I have several 1-M relationships with other tables
in the database from tblStates.
One table of contacts (tblContacts) now has 2
relationships with this table. This is the first time I've
run into this situation so I wanted to make sure this is
the correct way to handle this scenario. I have
address/city/state information already in the table, but I
needed to have an alternate address/city/state as well.
Incidentally, I know that perhaps setting up a third table
of address information for a M-M relationship might be the
better road to go, but let me just stick with this for the
moment.
When I dragged the StateID field from tblStates to
tblContacts in the relationships window Access said
something like "A relationship already exists with this
table. Do you wish to edit that one?" I said No and a
tblStates_1 appeared in the window. I was then able to
make a relationship between this alias (???) table and
tblContacts.
So first question: Is this OK as far as the relationship
window is concerned? Will data integrity still be OK since
I checked enforce RI?
I ran into some problems with a query on tblContacts used
to generate contact reports. To be honest, I can't write
SQL all that well so I rely on playing in the Design View
until I get things just right. It works very well for me.
My troubles came if there was no information in the
alternate StateID field. The query would then return
nothing in the first state fields even if there was data
there! So lots of trial and error later with join lines I
was able, I think, to make it work by bringing a second
tblStates into the query design grid. Again it did a
tblStates_1 thing. I adjusted the join lines and
everything "seems" to be working fine. I get data
displayed properly whether there are empty fields or not.
So second question: Is it all right to have this "alias"
table in the query?? Am I screwing things up??
Thanks for any help,
Jeff Conrad
Access Junkie
Bend, Oregon