Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can't change record value in a sequential manner

0 views
Skip to first unread message

David Pate

unread,
Jun 8, 2004, 10:55:36 PM6/8/04
to
Paradox database. In a table I want one of the field values to have at
least 5 charaters. So I want to search the table row by row and test
the length of the particular field; if less than 5 characters then add
leading '0' to make five characters. I would think this should be
simple but I have been unable to do it using SQL or TTable. Here is the
code for TTable, but I get the error that I must be in edit or insert
mode. (t is the ttable and DBG the grid)
begin
t.edit;
t.first;
while not t.eof do
begin
chartno :=DBG.Fields[1].text;
While Length(chartno) < 5 do chartno := '0' + chartno;
DBG.Fields[1].Text := chartno;
t.Next;
end;
end;
Thanks for help.
David

Bill Todd (TeamB)

unread,
Jun 8, 2004, 11:41:47 PM6/8/04
to
Each time you move to a new row the row you are leaving is
automatically posted which ends edit mode an puts you back in browse
mode. You need to call Edit inside the loop as shown below.

begin


t.first;
while not t.eof do
begin
chartno :=DBG.Fields[1].text;
While Length(chartno) < 5 do chartno := '0' + chartno;

t.edit;


DBG.Fields[1].Text := chartno;
t.Next;
end;
end;


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

0 new messages