do while !Stop if Somecondition Stop=.t. && instead of immediate termination, this would terminate only after enddo endif edndoMay be it's only impression, but why I had to use do while lnK
* support user Escapes for interrupting the main loop lcOldOnEsc = on('escape') && save previous Escape handler lcOldSetEscape = set('escape') && previous Escape enablement state set escape on && enable escape handling on escape oValid.StopProcess("Are you sure you want to stop Modify Process?") && Allows for stopping of the process. lnStartTime=datetime() do while oValid.lContinue and m.lnI<m.tnCount and !m.llStop lnI=m.lnI+1 && Increment count lcDBC=alltrim(taDBC[m.lnI]) if not file(forceext(m.lcDBC,'DBC')) set message to "Database "+m.lcDBC+" is not found!" wait window "Database "+m.lcDBC+" is not found!" nowait && ,48,"File does not exist" lcWholeLogStr=iif(empty(m.lcWholeLogStr),"",m.lcWholeLogStr+CR+replicate("*",65) + CR) + ; "Database "+m.lcDBC+" is not found..." else llDBCExist=.t. && At least one DBC exists if GetDBC(m.lcDBC) && Open database for possible changes lcDBCPath=addbs(justpath(fullpath(forceext(m.lcDBC,"DBC")))) lcWholeLogStr=iif(empty(m.lcWholeLogStr),; upper("Starting checking "+ m.tcAction+" at ")+ ; ttoc(m.lnStartTime), ; m.lcWholeLogStr+CR+replicate("*",65)+CR)+ CR lcWholeLogStr= m.lcWholeLogStr+ttoc(datetime())+" Database: "+m.lcDBC release laTables lnTables=adbobjects(laTables, "TABLE") && Create list of all tables in Database =asort(laTables) lnK=0 do while oValid.lContinue and m.lnK<m.lnTables and !m.llStop && Loop for all tables in DBC lnK=m.lnK+1 lcTableName=upper(alltrim(laTables[m.lnK])) if !CheckFreeDiskSpace(m.lcTableName, m.lcDBCPath, m.llFirstTime) llStop=.t. && Terminate all loops since not enough free disk space else llFirstTime=.f. llTableOpened=.f. if m.lcTableName<>"NEXTID" if OpenTble(m.lcTableName,'WorkFile','exclusive') && Open Table excl with alias WorkFile llTableOpened=.t. if m.tcAction='Structure' lcWholeLogStr= m.lcWholeLogStr+CR+"Table: "+ m.lcTableName+ ; " starting checking structure at "+ttoc(datetime())+CR if !Modify_Structure(m.lcTableName, alltrim(taDBC[m.lnI]), @lcWholeLogStr) llStop=.t. && Something was wrong here endif endif && Structure changes only lcWholeLogStr= m.lcWholeLogStr+CR+"Table: "+m.lcTableName+ ; " starting checking indexes at "+ttoc(datetime())+CR =Modify_Indexes(m.lcTableName, alltrim(taDBC[m.lnI]), @lcWholeLogStr) use in select('WorkFile') flush else && Table was not opened lcWholeLogStr= m.lcWholeLogStr+ ; ttoc(datetime())+" Table "+ m.lcTableName+ ; " was opened by another user and therefore was not checked..."+ ; +CR+replicate("_",65)+CR endif endif endif enddo && End loop for all tables within Database lcWholeLogStr= m.lcWholeLogStr+ ; ttoc(datetime())+" Finished checking tables in "+m.lcDBC+CR close database erase (m.lcDBCPath+'*.bak') erase (m.lcDBCPath+'*.tbk') endif endif enddo