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

How do you Set a Unique Index from code 1

Status
Not open for further replies.

xsnrg

Technical User
Jun 15, 2004
44
US
Follow up from thread705-884378

I have existing tables generated from an import code pulling SQL tables into my Access database. This import process looses the index definintions.

I need a second part of the code where I can set the index for the table. I've only found out how to do this within a Query or at the CreateDatabase process. But with the table already existing, how can I setup the primary key?

McLean Jones
buddycenters.org
"Believing is Seeing
 
Something like this ?
DoCmd.RunSQL "CREATE UNIQUE INDEX index_name" _
& " ON table_name (field1_name, field2_name)" _
& " WITH PRIMARY;"


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Fantastic... that works great...

McLean Jones
buddycenters.org
"Believing is Seeing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top