Create Database test Create Table test (ctest c(10), bogus c(10) primary key, bogus2 c(10)) Index On ctest Tag ctest Index on bogus2 Tag bogus2 Index on ctest+bogus2 Tag bogus3 Do While Reccount() < 100000 Store Sys(2015) To m.ctest, m.bogus, m.bogus2 Insert Into test From Memvar EndDoTo run test:
DropFields("test","bogus,bogus2")
** DropFields.prg LParameters tcTable, tcDropList Local llError, lcCommand Use (tcTable) Exclusive tcDropList = [,] + tcDropList tcDropList = Strtran(tcDropList, [,], [ drop column ]) lcCommand = [Alter table ] + tcTable + tcDropList On Error llError = .T. &lcCommand Do While llError AError(laError) If laError[1,1] = 1531 && cannot drop field because of index lcTag = laError[1,3] ? "deleting tag ",lctag && just for messaging Delete Tag (lcTag) llError = .F. &lcCommand Else Exit EndIf EndDo If llError ** Exited AError(laError) MessageBox("Error: " + Transform(laError[1,1])+Chr(13)+; laError[1,2], 48) EndIf On errorbtw, I've noticed in your code samples that you have the syntax coloring - do you have something you run that through before posting it, or do you take the time to do it by hand?