RE: TZF - Auto Increment
Glen Taylor <[email protected]>
| Newsgroups | gmane.comp.lang.delphi.topaz |
|---|---|
| Message-ID | <[email protected]> |
When i need to have a auto-increment i use another file thena has 3 fields 1)filename,2)autonumber,3)nextuniquenumber now every time i go to add a new record that need a auto number of any sort i read the file find the file name read the autonumber increment and resave this gives me a auto number. Now i use the next unquenumber field for invoice numbers etc for just incase the user exits without a save i only use this number when the record has been saved and i need the next in order number. Hope this helps Glen Taylor -----Original Message----- From: joseph.edwards [mailto:[email protected]] Sent: April 8, 2003 12:00 PM To: [email protected] Subject: TZF - Auto Increment HI everyone. Having struggled for another three hours to try and get an auto-increment on a field working, can anyone help me perhaps with some demo code? I can get it to work using the OnNewRecord and AfterInsert events, but I cannot deal with the situationn where the user cancels after choosing an append. In dBASE, I have control over exactly when I append the record and by using a matching set of memory variables I can update the autoincrement counter only when I actually append a new record. However if I use tzNavigator, and get the new incremented field value with the OnNewRecord event , when do I update this valuefor the next time? If you use AfterInsert this does not work as this triggers before the record is cancelled. I cannot use after Post as this would fire when any record not just a new one was posted. Similarly AfterCancel is no help either. Perhaps I have to keep a system flag to tell me when I am inserting a new record but this is getting very kludgy? Does anyone have any good ideas. Thanks in advance Joe ==^================================================================ This email was sent to: [email protected] EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt Or send an email to: [email protected] TOPICA - Start your own email discussion group. FREE! http://www.topica.com/partner/tag02/create/index2.html ==^================================================================