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

Question about creating indexes through sql with MS Acess

Status
Not open for further replies.

KevinCO

Programmer
Oct 2, 2001
45
0
0
US
Hi, thanks for reading my post, I appreciate it. I have an access db on a web site, I want to make one of the fields in a table an "index" that allows duplicates, the field is already defined and has a lot of instances, the question I have is, when I looked at the help file in Access the syntax is "CREATE INDEX NewIndex on TABLENAME(FIELDNAME)".
My question is why do you have to name the index?(like from the example above... "NewIndex" after "CREATE INDEX")? Does this alter how I have to use the field when I use it in SQL statements in "WHERE FIELDNAME = WHATEVER" instances? Thank you for your time.
 
Lots of things in Access have names that you don't usually need to know or be aware of. Another example is relationships: when you create a relationship between two tables it has a name, you just don't know what it is.

In answer to your questions, you have to name the index because Access won't let you create one in this way without a name! I would tend to use something related to the field name (perhaps the field name appended with a number?) as a sensible naming convention.

In answer to your second question, no, this doesn't affect how you would subsequently refer to an indexed field in an SQL query.

Hope this helps. [pc2]
 
Thanks mp9, I appreciate the help very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top