how do i created multiple fields from a single field?

G

Guest

I have a databse with voter information on it. I have put together all the
data on a single table, but the records show each vote as a single record.
This causes mulitple entries for each person. I was wondering if there is a
way to take the inforamtion from the year field (The only differing info) and
create multiple fields from it? The end result would have a single voter with
many fields, each displaying a single year in which they did or did not vote.
 
C

Chaim

It sounds like you don't want to do what you are proposing.

It is a violation of the relational model to put identical data in multiple
fields of a record. Based on the scenario described, you should have at
least two tables: 1) one for the names of the people, and a way of
identifying every individual (otherwise you can't tell the difference
between one 'John Doe' and a different 'John Doe'); and 2) one that records
the votes, the year and the id of the person casting that vote in that year.
If the person didn't vote in a given year, there is no record. The two
tables would be related by the person ID fields.

Makes it much easier to retrieve and manage your data and insure its
integrity.

--

Chaim


Lordadimar said:
I have a databse with voter information on it. I have put together all the
data on a single table, but the records show each vote as a single record.
This causes mulitple entries for each person. I was wondering if there is a
way to take the inforamtion from the year field (The only differing info) and
create multiple fields from it? The end result would have a single voter with
many fields, each displaying a single year in which they did or did not
vote.
 
A

Al Camp

It sounds, from your description, that you have a "flat" database... and
your running into problems as the data continues to grow, and gets harder to
handle. The real soltion lies in proper table design, and using the power
of a relational database to proper advantage.

You should have 1 table for voter information (ex. tblVoter... with name.
address, etc) with a key field identifier number for each voter. (ex
VoterID)
All the vote records should be in another table (ex. tblVotes) with
fields VoterID, Year, Vote.
Those tables should be related by a One to Many relationship... One voter
could be listed on a main form bound to tblVoters, and all votes by that
voter displayed in a subform based on tblVotes, and related by the VoterID.
Then, the subform could be filtered easily for a particular year.
Also, new voting data can be added ad infinitum, without any trouble at
all, and querying and reporting on voting data would be a snap.

You wrote...
...way to take the inforamtion from the year field (The only differing
info) and
create multiple fields from it?
I don't understand what you mean by "create multiple fields."
Please supply some sample data... what you have now.... vs what you'd
like to see.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 

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