Ozzone's method will give you the numbers but will not assure the
"non-repeating" requirement.
If you have a really good reason for the requirements for a non-repeating
random number between 10,000 and 100,000
1. build a table with one field (PartNumber) then enter the values 10,000 to
100,000 in that table.
either via code or use excel to build the numbers, then import.
2. build another table with two fields ([randomNumber]: set as key field,
autonumber, long integer, New Values: Random), [PartNumber], number, long
integer
3. build an append query to append all the records from the first table into
the second.
Now you have a table with two columns
Now you have a table with part numbers matched to random numbers that are
unique, but not within the given range.
4. build yet another table with [SelectOrder] as autonumber, KeyField, New
Values: Increment, [Partnumber], number, long integer)
5. Now build an append query based on table two (order by randomNumber
ascending) and append the PartNumber to the table.
Now you have partnumbers in the assigned range randomly assigned to integers
1-90,000 which are unique.
Build your Parts Table, use [PartID], autonumber, increment, keyfield
Then anywhere you need the random [PartNumber] add the crossreference table
to the query and pull out the random number.
e.g.
CrossRefTable
[SelectOreder] [PartNumber]
1 12345
2 98765
3 xxxxxxx
Parts Table
PartID PartDescription
1 widget, large, left handed
2 widget, small, right handed
3 widget, large, right handed
ect.
with a query would result in:
[partID] =1
[PartNumber] = 12345
[PartDescription] = widget, large, left handed
etc.
Now when you database grows past 90,000 widgets you can just add new numbers
to the crossref and proceed.
Ed Warren