Thanks for the reply Jan, but if there is an active Index then a sequential edit will not work. The Index has to be cleared before the Edit. Let's say you need to change a bunch of Accounts by resetting a Status Boolean.
[align=left]
Code: Select all
tbl.IndexFieldNames:='Account Asc';
tbl.First;
while not (tbl.EOF) do
begin
tbl.Edit;
tblAccounts.FieldByName('BadCust').AsBoolean:=False;
tbl.Post;
tbl.Next;
end;
[/align]
If the Index is active it will change ONLY that record and then place the file cursor at the end of the file so only one account gets changed. I have to disable the Index (and Filtered if active) in order to iterate through the Table.
In fact, if you change that loop to .Last, .Prior and .BOF it will loop there forever as it can never leave the EOF.
I am not sure if it is a Zeos thing or an SQLite thing, but I spent 3 hours yesterday trying to make it work. It was not until someone on another forum suggested clearing Indexes that it finally worked.
I would like to know if it is OK to just do as I wrote in code in the OP or whether there is some risk to the Database integrity doing that way.
Thanks