Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Autonumber keeps incrementing even when Revert
Message
From
07/11/2002 01:22:22
 
 
To
06/11/2002 11:39:47
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00719330
Message ID:
00719688
Views:
13
Hi!

Your idea is correct. Have another dummy table with a single AutoIncrement field. When you really update record in main, insert record in that dummy table that will generate new number. Copy that number into your record and update second time to make that number updated ok. Then revert record in a dummy table (so it would not grow). This way you'll get number auto-incremented ONLY when main record is saved. Of course, check number field should be not auto-increment in such case. AND, as already pointed somewhere in this thread, for correct working, you should have "hidden" PK fiels that is really auto-increment for normalized database structure - real-world data (like check number) should not be used as PK.

Note that you will require to have another dummy table for each another field of such kind as check number.

HTH.

>>>Just trying out the Vpf8 beta,in my table i set logno as autoinc field and created a form using wizard for that table and when i click add the autonumber increments,but after clicking revert and then again click add the number doesn't seem to get reverted.it just keeps incrementing.
>>
>>Craig is correct: the actual value shouldn't matter, just that it's unique. Besides, imagine this scenario: you add a record, assigning the next available ID to it (let's say it's 5). Then another user adds a record, getting 6 for the ID. Then you TABLEREVERT(). What should the next available ID be? Should it be 5? If so, then what happens when someone uses it? The next one can't be 6 since that's already been used.
>>
>>The autoincrement feature isn't intended to be a completely sequential value without holes in the sequence. In addition to reverts, when you delete records and then pack the table, the ID values aren't renumbered, so there will be holes in the sequence in this case as well.
>>
>>Doug
>
>Doug your example was correct,but if i want to assign check number and print the checks i can't have a break in numbers.then i have to void the check.that's what i want to avoid by autonumber.
>
>another question is
>
>Can i force the autonumber to generate when i click Save. I think that would solve the problem.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform