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

How can I check if index exists before creating a new one: Access2000?

Status
Not open for further replies.

mb22

Programmer
Sep 4, 2002
258
US
i have several queries which works fine in a macro. ...all the queries are like this

CREATE INDEX Company_ID ON Company (Company_ID) ;

however sometimes the index exists already .... and it causes my macro to bomb? Is it possible to modify the queries to check for the existence of an index before creating it?

Or do I have to create sveral queries like in addition... before running the CREATE index queries

DELETE INDEX Company_ID

I guess another problem will be I will get an error that No such index exists?

I'm running Access 2000..... Any ideas on how best to run my queries in a macro or oterwise is welcome
 
Dear MB22:

I do not have ideas for Macros because I generally write code modules. However, if you write a code module to run the SQL there is an easy fix. When the code bombs, you could trap it in an error routine and resume appropriately. It is often faster just as easy to trap an error as write the logic for checking first. I do not know if macro's have any potential for error traps but it might be worth looking into if you are already good at macros.

Vel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top