Sunday, October 27, 2013

Adding Numbers in sequence into the Field


1) Add the number field. -Show me-
2) Click Start editing on the Editor Toolbar.
3) Right-click the new number field. Click Calculate Values.
4) Click the Advanced check box.
5) Copy the following code into the Pre Logic VBA Script code:

Static rec As Long
Dim pStart As Long
Dim pInterval As Long

'Adjust start value if you want it to
‘Start at a value other than 1.
‘For example: 1000.
'====================================

pStart = 1

‘Adjust interval value if you want it to
‘Increment at a value, other than 1.
‘For example: 2.
' =======================================

pInterval = 1
If (rec = 0) Then
rec = pStart
Else
rec = rec + pInterval
End If

6) Type the word 'rec' in the text box under [Your Field Name] =
7) Click OK.