If it's elaborate and/or complicated I use this method all the time.
Step one is creating a temp table with all kind of helpful fields (0 AS FieldNumeric, '' AS FieldText, etc.), as many as you like.
Don't forget the ID of your initial table.
Second step is starting a loop (recordset) and...
I'm very aware of the risks of carthesian queries.
But the proof of the pudding is in the eating.
Spoiler alert: creating the table with 100.000 records takes ... 1,1 seconds
I just tested the same code but with 1 million records: 9,5 seconds.
In both cases my database grows from 13188 kB to...
I'm a retired SQL Server database administrator from Belgium. My specialty was writing stored procedures for high level performance (tables > 6 billion records). My VBA modules contain about 35.000 lines of coding, for more than 40 different applications. My goals are: efficiency, accuracy...
4 steps:
1/ declare a global
Global glolngIncrementSequence As Long
2/ create a function
Public Function fncIncrementSequence(ByVal varDummy As Variant) As Long
' Very important: varDummy must be any non empty text value
glolngIncrementSequence = glolngIncrementSequence + 1...