Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ensuring no duplication of data in rows

Status
Not open for further replies.

TheEnigma

Technical User
May 26, 2002
69
0
0
US
Hi there,

Is it possible to set up a table so that no one can enter duplicate data for an entire row?

Example of what I mean

Stats_tbl

id field
Username field
Date field
other field

The 4 fields above will often have some of the same data appearing in them. Another words username field will have the same name apearing, but on different dates.

What I want to make sure of is that no one enters the exact same information that is in one record of the table, as another record of the table.

Hope that makes sense.... :?
 
in the table design, choose the fields that you want to be unique and hit the PRIMARY KEY button. that means that only one combination of the fields you choose can exist. i.e. only ONE combination of Username, Date and Other if that's what you want.
 
Won't that mean that the table won't take the same date then?

I have 5 people using the database, and all 5 people will enter information in on the same day. My understanding of the primary key field is that it wouldn't allow duplication in the same row?
 
select Username and Date at the same time, and hit the Primary key button (the Key on the toolbar) or u can go to view/indexes and set the following:

Index Name : PrimaryKey
Field Name: Username
Field Name (on second row): date

this way, the row will be unique based on the username and date.
so other users can enter on the same date.

good luck
Rania
 
Enigma--isnt that what you want?
User 1 enters: John Smith 4/18/03
User 2 enters: John Smith 4/18/03
but User 2 gets an error message cause that combination of data has already been entered and User 2's record is not added to the db, right?
rhammud said the same thing I did.
am I missing something here?
 
GingerR: u r right, I thought u said "field" but now reading it again, it was "fields". so u r right, it should work with Enigma.
 
Create the primary key on [id field]

Then display the indexes and create another unique index on the fields you want to make a unique combination (do not include the [id field] in the index).

This will give you the possibility of having joins on one field ([id field]) and at the same time keep the integrity of data in the table.

Good luck



[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top