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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defining an customised autonumber

Status
Not open for further replies.

nqobile

Programmer
Aug 9, 2002
20
SZ
How can I make a number field automatically increment in a table withouth using autonumber.
I dont want to use autonumber because it has limitations.
 
You can via code in your db...


It also has restrictions as in there is a slight possibility of there being two numbers that are the same - but you can code for that problem/catch the error and respond accordingly.

You need a table which will hold the ID (number that increments or string or whatever). Your code grabs the number, increments it and returns it to the table, holding the original number back for your process (use a function).
This in theory over a multi-user network with fastish connections should work without conflict, but you'd know if you have a conflict when you save the record. Please note this is more for Unbound forms than the crap bound forms and that if you create a number it is always incremented, otherwise the chances of clashing unique numbers is increased.

Or, if its just a display problem (like you need QUREF000100 for record 100), I'd use a format command or format on the text box and keep the unique ID. You can always keep the autoincrement as the record ID but use another field for the displaying ID...

Lots of options.

Vince
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top