Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to implement a autoincremental field in grid??
Message
 
 
To
15/04/2001 12:03:34
Ransome So
Ransome's Workshop
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00495648
Message ID:
00495649
Views:
11
>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.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform