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

Autonumber in increments of 10??

Status
Not open for further replies.

Turb

Technical User
Feb 11, 2003
154
US
All,
Does any one know of a way to make an autonumber field in Access 2K increment in 10's? For example, 10, 20, 30, 40... etc.
Thank you for any help.

Ind. Engineering Tech.
 
Turb,

Do some searching around here and at comp.databases.ms-access for autonumbers. They should not be used if the number will ever have any significance at all. Access will generete unique numbers, but there is no guarantee that they will be sequential--that's not part of the design plan.

There is lots of code out there for generating your own unique identifiers, if you search for it Just make sure you're not doing a simple dmax on the field in the same table--that's guaranteed to fail sooner or later. And don't worry about people saying that access doesn't generate unique auto IDs. That's only true if you've got outdated dlls on your computer.

The best code I've seen for doing this comes from the Access [version number] Developer's Handbook. It's the best Access resource I know of.

I don't actually know if it's possible to set increment values for an autonumber field, as I've never looked into it.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
you can't really.....but you can mimic it by placing:

#\0

in the format field for the autonumber field.

****************************
Computers are possibly the most un-intelligent things ever invented, yet we let them control the world. Possibly a reflection of our own stupidity.

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
And Jeremy is right....forgot to mention that part...

****************************
Computers are possibly the most un-intelligent things ever invented, yet we let them control the world. Possibly a reflection of our own stupidity.

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Jeremy and Robert, thank you.
Jeremy you state,"They should not be used if the number will ever have any significance at all". I am a little unclear on what you mean by this. I need these numbers to auto increment in series of 10 for use in our field service database. These numbers will be the technical service unique id for each call and I had planned to place 'TS-' in the format property of the field so the data will show up on the forms/reports as TS-0010, TS-0020, etc. I also wanted to allow the creation of TS numbers between the 10; TS-0011, TS-0012.
So that as other calls come in (if any) about the same unit, the field service people can suppliment the original TS number. This can't be done with an autonumber field?

Ind. Engineering Tech.
 
Well, if you wrote a lot of code, it could be done, but It would be a really bad idea. You don't want autonumbers, you want numbers that have some significance. The id numbers you've described tell your users something. That's fine. That's great, in fact. But that's not something to which autonumbers are suited.

I would suggest that you use a normal autonumber field to be the primary key of your table and you write code to generate the id field you've described. All your linking to other tables will be done on the PK/autonumber field. But that field won't ever be displayed to the user. The other field you've created will be displayed to the user. That way, you make sure that the numbers you're using are the numbers you want.

Do some searching for articles on autonumbers. People have written about it thousands of times.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
What you describe Turb IS giving AutoNumbers a SIGNIFICANCE and this is generally BAD News in any shape of form

What you are suggesting rings even more alarm bells

What will happen in your structure when your 'thread' gets to TS-0019 and another related call comes in ?


What I'd suggest ( given the limited info provided ) is a table with a ServiceNoId field that increments in steps of ONE
Then have a MasterNoRef field that can act as a Foreign Key pointing to the ServiceNoId in the same table
and a SubCallNo field where you store the ( Zero Based ) increment counter.

You can then display the whole lot as something like
"TS-" & ServiceNoId & "." & SubCallNo

You then have NO limit to the number of follow-un calls that can relate to any one starter call



'ope-that-'elps.






G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top