webbedrecords

Populate a field with consecutive numbers by a constant length string.

Discussion created by webbedrecords on Jul 20, 2011
Latest reply on Jul 29, 2011 by webbedrecords
Hi,

I'm searching for an arcpy script or VBscript for the field calculator so I can populate a field with consecutive numbers represented by a constant length string. The consecutive numbers can come from the "FID" field.
Example:
000001
000002
...........
000011
...........
000345

I had a VBA script from Easycalculate who does the trick, but it doesn't work in ArcGis 10.
VBA script:

'rec_Number_ConstantLengthString.cal
'Author: Ianko Tchoukanski
'http://www.ian-ko.com
'=========================
Static rec As Long
Static j As Long
Dim lStart As Long
Dim lInterval As Long
Dim i As Integer
Dim iStringLength As Integer
Dim sID As String
'============================
'set the variables below
iStringLength = 7
lStart = 0
lInterval = 1
'============================
sID = ""
If (j = 0) Then
  rec = lStart
Else
  rec = rec + lInterval
End If
For i = 1 To iStringLength - Len(CStr(rec))
  sID = sID & "0"
Next i
sID = sID & CStr(rec)
j = j + 1


Anybody any ideas?

Outcomes