how to setup for 2 addresses per person

B

Boze

I'm very new to Access so this is a very basic question.
As my first project I'm setting up a database on politicians in my state.
Some will have 2 addresses..1 in our state and 1 in Wash DC. They also will
have 2 websites.. their official site and their re-elect site. I'm not sure
how to set the tables up for this. Would I use Address1, City1, Phone1, etc
for the state info and a separate table with Address2, City2, Phone2 for the
DC ?

Thanks for any help. I'd also be interested in any online tutorials if
anyone cares to recommend some.

Boze
 
K

KARL DEWEY

Use the same table and have a flag field for residence R, work W, vacation V,
etc.
 
B

Baz

Boze said:
I'm very new to Access so this is a very basic question.
As my first project I'm setting up a database on politicians in my state.
Some will have 2 addresses..1 in our state and 1 in Wash DC. They also will
have 2 websites.. their official site and their re-elect site. I'm not sure
how to set the tables up for this. Would I use Address1, City1, Phone1, etc
for the state info and a separate table with Address2, City2, Phone2 for the
DC ?

Thanks for any help. I'd also be interested in any online tutorials if
anyone cares to recommend some.

Boze

I suggest that you simply create two sets of fields on the one table.
 
T

Tim Ferguson

As my first project I'm setting up a database on politicians in my
state. Some will have 2 addresses..1 in our state and 1 in Wash DC.

I don't believe this: there will also be the agent's address, the home
address, the one to send bulk material to, the billing address, etc etc.
They also will have 2 websites.. their official site and their
re-elect site.

Ditto: what about the opponent's knocking site, the unofficial fan site,
the IMDB page, etc, etc?
I'm not sure how to set the tables up for this.

It's simply two straightforward one-to-many relationships e.g.

People (
PersonID primary key,
FirstName,
LastName,
NickName,
CurrentCredibility,
etc )

Addresses (
BelongsTo foreign key references People,
TypeOfAddress
Street,
City,
etc
Primary Key (BelongsTo, TypeOfAddress)
)

Websites (
URL primary key,
BelongsTo foreign key references People,
LastVisitDate,
etc
Primary Key (URL, TypeOfWebsite)
)

To make the compound primary keys, in the Table Design grid, ctrl+click
both fields and then click the yellow key Primary Key tool.

If the PersonID is an autonumber, then the two BelongsTo keys must be
long integers. Use the relationships window to drag BelongsTo over the
People.PersonID and remember to check ON the box for Enforce Relational
Integrity.

You might want to use another table(s) to control the contents of the
TypeOf fields
I use Address1, City1, Phone1, etc for the state info and a separate
table with Address2, City2, Phone2 for the DC ?

No: that way disaster lies. It will be one week after release when
someone wants a third address type, and then you'll be redesigning every
single table, query, form and report. Better just to design it right
first time and then sit back relaxing...

Hope that helps


Tim F
 

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