Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question About Sequential Numbering in Mutiple User Env.

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
0
0
US
Good afternoon. I have one small concern with my dbase. I decided to use sequential numbering instead of the Access autonumber. I also put in pessismistic locking to keep people from screwing up records being edited. I have seen alot of date and sequential number procedures, but I am going with just a straight 1 2 3 type sequence. When the form opens the number already appears in the text box. How much do I have to worry about a duplicate number appearing? And if it is a problem, is there an easy way to correct it? I have about 20 users. Thank you to anyone answering this one.
 
Hi. I use my own record numbering logic. It numbers items sequentially. The "next number" is stored in a table and is only appended to the new record in the Form's AfterInsert property. It's very quick code and therefore prevents items from being entered out of sequence.

If you already have code that works, just fire it from the AfterInsert event.

Jim DeGeorge [wavey]
 
Thank you for the response, Jim. Currently I am just using a simple DMax in a module and I set the Default Value, of the textbox, equal to the function. I am a little worried that I may get duplicate numbers out of this. I am in the insane world of ISO9000, no missing numbers and of course, no duplicate numbers. It appears to work in the test mode, but it is when it goes into the real world, multiple users, that I worry. Has you method had any problem, when a record is canceled, can that number be reused? Thanks you again for the response.
 
I run a bit of code that finds the highest number in the table and adds 1 to it. (Obviously to get the next number)

I have this code on the after update event on one of my controls. I also include some code to save that record as soon as this is done.

I found in a multi user environment if you didn't save it straight away you could get duplicates.
 
Hi

In a multi user environment, generating sequential numbers using he mthods described, WILL give duplicates it is just a question of how often. Put a unique key on the column in question, then at least Access (or Jet) will not be able to actually add the duplicate key, instead it will raise an error which you can trap, raise a new number and try again, repeating until eventually you do get a unique number.

Hope this helps

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thank you for the response, guys. Ken I already have that field set as the PK, with no dup's. Mark I understand what you are saying and I will try and figure out something that works better that the DMax code that I am using now. Thank you for your input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top