Duplicates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

dCan anyone help? I have 12 fields in my table - the first is 'name' and the
other 11 fields my problem. I need to combine all these 11 fields so that no
duplicates can be given. e.g. if someone registers and enters their name,
they need to then choose 11 other pieces of info (which is the 11 fields) -
however, within these fields, they cant have the same data twice (e.g. fields
2 and 8 cant both be the name 'jubilee'... does that make sence - its hard
to describe.

I then need an error message to appear when they do enter a duplicate. I can
prevent duplicates in one field, but i guess im asking how you to this over a
number of fields? Any Ideas?
 
AccessNewbee said:
dCan anyone help? I have 12 fields in my table - the first is 'name' and the
other 11 fields my problem. I need to combine all these 11 fields so that no
duplicates can be given. e.g. if someone registers and enters their name,
they need to then choose 11 other pieces of info (which is the 11 fields) -
however, within these fields, they cant have the same data twice (e.g. fields
2 and 8 cant both be the name 'jubilee'... does that make sence - its hard
to describe.

It makes sense, but it also sounds like columns 2-12 are "repeating"
columns, and therefore are not normalized.

One way to solve this would be to normalize, use a sequence number,
and a unique index.

Names:
NameID -- PK
Name

OtherCols:
NameID --\ --\--FK to Names
Seq --- 2-col PK (NameID, Seq) \
Value ----------------------------- 2-col unique index (NameID,
Value).


NamesID, Name
1, Mark
2, Mary


NameID, Sequence, Value
1, 1, Jubilee
1, 2, Rock
1, 3, Paper
1, 4, Scissors
1, 5, <can't enter Jubilee or Rock or Paper or Scissors here>
2, 1, Jubilee
2, 2, Rock
I then need an error message to appear when they do enter a
duplicate.

You would receive one when using the setup above.

I can prevent duplicates in one field, but i guess im asking how you
to this over a number of fields? Any Ideas?

This will do it.


Sincerely,

Chris O.
 

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

Back
Top