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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you Index a Text Field?

Status
Not open for further replies.

soloprogrammer

Programmer
Oct 8, 2001
9
US
I'm using Microsoft Access 2002 with a SQL Server backend for an application. I have a table that has a primary key with an identity that is automatically generated. And then I have a column in that table that is a text field that I do not want the users to be able to duplicate. Is there anyway to add an index to this text field so that it can't be duplicated or is there a better way to do this?
 
Yes, you can put a unique constraint on the text field. To do this perform the following steps:

(In Enterprise Manager)
1. Right click on your table and select design table
2. Right click on any column name and select Indexes/Keys
3. Click New
4. Give your index a name and select the field that you want to put the index on from the drop down
5. You should see a check box called "Create Unique" - put a check mark in there and make sure the "constraint" radio button is selected.

Leave everything else the way it is and you should be good to go. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top