Creating list of records by given range of numbers

Jonny

Registered User.
Local time
Today, 21:54
Joined
Aug 12, 2005
Messages
144
I have a range of board serial numbers, starting from SN0000001 and till SN0001000.
How can I create automatically 1000 records, what the VBA code to do that?
 
You can open a recordset on the target table, and use a For/Next loop with your starting and ending numbers. Within the loop, use the AddNew method of the recordset to add a record.
 
If all values start with SN you should not include that in the stored value. Only store the number and display the SN and zero padding by using the Format property of the control where it is displayed on the form or report.

Type this into the Format property:
"SN"0000000

It is much easier to increment a number than a string and much faster for Access to work with a number field.
 

Users who are viewing this thread

Back
Top Bottom