>Dear all,
>
>In my project, a grid hosts the detail transactions of a voucher. By altering the allowaddnew property of the grid, I add new records, while that a column in the grid named line no. which record the line number which helping me to inserting and deleting records. Can I do that when a new line is added by switch allowaddnew property to .t. , the line no. column automatically increment a new consequent line number?
>
>
>With regards,
>
>Ransome
For the field in question, configure the Default Value property to generate the next number. You could specify a function that calculates the next value or retrieve it from a table. When the new record is added, the function will execute and populate the grid's source for you.
If the grid's Rowsource is a table, add it to the table structure. If the source is a view, use DBSetProp() to set the property of the view when you opne it.
Of course, this only works if the table in question is part of a database. Default Values can not be set for free tables.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao