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

Automatic Generation of Next Available Number 1

Status
Not open for further replies.

khwaja

Technical User
Aug 27, 2001
431
AU
I have a certyain ranges of numbers within which I create new records to identify stores. These numbers are called location numbers. At the moment, some of these location numbers have bee taken up but there are quite a few available for new locations.

Is there any way that when I am creating a new record, I could be suggested by the system the next available location number I can use to assign to a new location?

Hope someone could help?

Cheers
 
? autonumber ?

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Michael

Autonumbers are sequential and unlimited. I have ranges of nunmbers which have geographic meanings. As I am based in Australia, my location nunmbers fall within certain States, as under:

New South Wales 2000- 2999
Queenasland 3000 - 3999

and so on.

I would like to be able to select unsused numbers out of these ranges. For the moment let us take a whole range of 2000 to 3999 leaving aside the geographis split. So back to my original question, can we be offered an unused number when creating a new record? Or based on your question, is it possible to restrict auto number between certain ranges and then we can safely create a new record within the range.

I hope this clarifies.

Cheers

AK
 
NO autonumber with range. Such an arrangement is somewhat foregin to the concept of indicies and keys, buut it can be done. see faq700-184 for one rather strange construction. It (still) only generates "sequential" values, so it is not THE way you need to go, but has a few nuggets of help.

If (as I think you are saying) the available "keys" are unused within the range, you need a process which ssearches within the range for a missing (Gapped) value and returns one if foound, and an error value if NOT found. A simple Select w/ the range woule easily return the USED set, if ordered, a trivial procedure could fo the search - return found (gap) or error signal if no value avail.

Setting bounded ranges for the representation of keys is POOR. It leads EXACTLY to the delimia you have. Hence my (rather cryptic) suggestion to simply use autonumber (or variation). Set up the regional / area mapping seperatly.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Thanks a lot for your your help.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top