gurshaan
asked on
Autp record number problem
When I Choose new record, and then I decide to cancel and later on I want to choose new record I gave me extra record number. What script I should use ? Example will help you to understand better
Example: Existing record number = 1000
[ON CLICK A BUTTON I GET NEW RECORD NUMBER] = 1001
then I decide not to proceed I choose to cancel /delete
Next day I went back to database and I like to add new record
and the record number should be 1001
But I’m getting record number = 1002
I'm using auto enter serial number with one increment. Some one suggest me to make a script for deletetion when I delete record it should delete record number too , but I'm unable to come up with script.
Please give me complete script
Thanks
Example: Existing record number = 1000
[ON CLICK A BUTTON I GET NEW RECORD NUMBER] = 1001
then I decide not to proceed I choose to cancel /delete
Next day I went back to database and I like to add new record
and the record number should be 1001
But I’m getting record number = 1002
I'm using auto enter serial number with one increment. Some one suggest me to make a script for deletetion when I delete record it should delete record number too , but I'm unable to come up with script.
Please give me complete script
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>if you have a button, as soon as you create a record, nothing
>prevents you from browsing to a different record:
You could just omit all records before creating the new one. Wouldn't prevent a determined user from screwing up, but it would reduce the chance of careless browsing.
Unfortunately my FM is in french but I will try to translate the script I use or that :
1- Sort ( no dialog )
2- Display record (last)
3- Define serial number following ( "Number_Field", "Number_Field+1")
Normally after 1000 you will get 1001 even if you have deleted 1001 previously
Good luck
José
1- Sort ( no dialog )
2- Display record (last)
3- Define serial number following ( "Number_Field", "Number_Field+1")
Normally after 1000 you will get 1001 even if you have deleted 1001 previously
Good luck
José
I like my answer. Pity the asker doesnt care.
/prifre
/prifre
fair, he was the 1st to jump on this one!
No objection from me...
I agree with the others, this is probably not the problem you think it is. If you just want a sequential number series, follow prifre's suggestion and use the status(recordNumber) function.
Think of the autonumber as a record of database activity rather than just a sequence number. This can be useful when troubleshooting. Also, you can deliberately create gaps as a way of tracking when data was entered.
Example: Last year, the records in a table were all in the range 1000 to 40000. After a major change to our policies was made, I increased the autoincrement to 100,000. Now I can tell at a glance which records are from before the change, without having to remember the date the change was made, or add an extra flag to the table.