if Label1.Caption='Reestruturando Tabelas' then begin Temp3:=42; for Temp1:=1 to 2 do begin if Temp1=1 then begin Tabela.DatabaseName:='C:\Sigma\Controle\Banco de Dados\Principal'; FileListBox1.Directory:='C:\Sigma\Controle\Banco de Dados\Principal'; FileListBox1.Update; end else begin Tabela.DatabaseName:='C:\Sigma\Controle\Banco de Dados\Arquivo Morto'; FileListBox1.Directory:='C:\Sigma\Controle\Banco de Dados\Arquivo Morto'; FileListBox1.Update; end; for Temp2:=0 to FileListBox1.Items.Count-1 do begin Origem:=UpperCase(FileListBox1.Items.Strings[Temp2]); if Copy(Origem,Length(Origem)-1,2)<>'DB' then DeleteFile(FileListBox1.Directory+'\'+Origem); end; //********** INÍCIO DA REESTRUTURAÇÃO **********// Tabela.TableName:='Aniversariantes.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorNome','Nome',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='Cheques.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]); Tabela.AddIndex('PorValor','Valor',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='ChequesDesconto.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='Clientes.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorCodigo','Codigo',[ixCaseInsensitive]); Tabela.AddIndex('PorNome','Nome',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='ContaCorrente.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='ContasCredito.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorNome','Cliente',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='ContasPagar.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorNome','Fornecedor',[ixCaseInsensitive]); Tabela.AddIndex('PorVencimento','DataDM',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='ContasReceber.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorNome','Cliente',[ixCaseInsensitive]); Tabela.AddIndex('PorVencimento','DataDM',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='DescontoCheque.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='Fornecedores.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorCodigo','Codigo',[ixCaseInsensitive]); Tabela.AddIndex('PorNome','RazaoSocial',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='Funcionarios.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='Grupos.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorNome','Nome',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='LivroCaixa.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='MalaDireta.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorNome','Nome',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='NFEntrada.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='NFSaida.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='Orcamentos.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='Previsao.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorData','Vencimento',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='Recebimentos.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='Produtos.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorCodigo','Codigo',[ixCaseInsensitive]); Tabela.AddIndex('PorNome','Produto',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; Tabela.TableName:='Vendas.db'; Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]); Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]); Dec(Temp3); Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%'; Update; end; Sleep(1000); end;