Subject how to maintain data position on newly inserted row
Author R. S. Patil
Hello Friends,

I have a updatable query on a table.

<fields ....>
< table Name >
for update;

The primary key for that table is work_day + Tran_no (i.e.
Tran no starts from 1 for each work_day).

On the i insert a record in the query. Then user
updates the fields on the form. when done he presses OK
button. On OK press i use and tran_no is
generated in before insert trigger of the table. The Tran_no
is generated with help of Generator and records are being
inserted properly without PK violation exceptions. Now i
want to get the Tran_no generated in the afterPost event of
the query and show it to user.

I tried

in AfterInsert event of query
BkMrk := qry.Bookmark;

in afterPost event of query
Tran_No := qry.FieldByName('TRAN_NO').AsInteger;
Showmessage (... + intToStr(Tran_No));

I am always getting Tran_no 1 even though tran_no advances
to value like 2,3,4,5.

Can somebody tell me how to maintain data position on newly
inserted row and refresh the row buffers freshly inserted.