Question : Drop all Indexes

I searched Experts Exchange for a SQL/VBA command that would allow me to remove all indexes from all tables in a given database.

I came across one posting (see VBA below) that might just do what I'm after.    Before executing the VBA though, I'd like to make sure that it only removes the indexes from the database that contains this procedure.  

Can some please confirm that it does exactly that and NOT remove indexes from other database files?

Thanks,
EEH
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
Function RemoveALLIndices() As Boolean
	Dim idx As DAO.Index
	Dim tdf As DAO.TableDef
	Dim db As DAO.Database
	Dim intIdx As Integer
	
	Set db = CurrentDb

	For Each tdf In db.TableDefs
    		If Left(tdf.Name, 4) <> "Msys" Then
        		If (tdf.Attributes And dbAttachedTable) = 0 And (tdf.Attributes And dbAttachedODBC) = 0 Then
            			For intIdx = tdf.Indexes.Count - 1 To 0 Step -1
                			tdf.Indexes.Delete tdf.Indexes(intIdx).Name
            			Next
       			End If
    		End If
	Next
        
	RemoveALLIndices = True

End Function

Answer : Drop all Indexes

It does not ... you are Good To Go.

The clue is here:

Set db = CurrentDb
               ^^^^^^^

mx
Random Solutions  
 
programming4us programming4us