Gustav Brock
gustav at cactus.dk
Wed Oct 22 15:35:08 CDT 2008
Hi Bob
One method is to create the table with two fields:
Guid - Autonumber Guid
> save table, then:
Id - Autonumber Long, Format: 0000000
Now, run this sub:
Public Sub T2M()
Dim rst As DAO.Recordset
Dim lngCount As Long
Set rst = CurrentDb.OpenRecordset("tblRandom")
For lngCount = 1 To 2000000
rst.AddNew
' A record is created. Save it.
rst.Update
Next
rst.Close
Set rst = Nothing
End Sub
This will take a while to run as the table continuously sorts on the (by nature) random Guid. However, this is what you want as - when you open the table - it will be sorted by the Guids, thus the Ids appear in random order.
To preserve the formatted field Id, you may at this point add a new text field of length seven which you update to the formatted value of field Id; if the table is fixed, you may now choose to delete the Id field.
/gustav
>>> bheygood at abestsystems.com 22-10-2008 18:59 >>>
Hello to the list,
I need to create a table of one row that looks like below:
0000001
0000002
0000003
2000000
I have had no problem so far.
But the client wants the table output to be random. Like:
1114453
0000022
2000000
0048941
And so forth. And of course no repeating rows......
Any thoughts??
Bob