ArcGIS Script Help
I am an ArcGIS user and I need to implement the following code into an Event Handler for ArcPad 7.1 (SQL Compact Edition database on Windows Mobile v5.0 platform). I can provide the ArcPad object model diagram if necessary.
I am getting a Syntax error:(800A03EA- Line 2 Column 3
(Source Text Unavailable
(Sub InitializeForm
Code:
InitializeForm ReturnNextID
Sub InitializeForm
Dim objEditForm, objEFP1Ctrl 'Reference custom form and control
Set objEditForm = ThisEvent.Object 'Reference event handler object
If Not objEditForm.Mode = 3 Then 'Force form's Edit mode
Exit Sub
End If
Set objEFP1Ctrl = EditForm.Pages("PAGE1").Controls 'Ref control
objEFP1Ctrl.Enabled = False 'Disable user input to control
Dim objOutfallsRS
Set objOutfallsRS = Layer.Records 'Ref record set
objEFP1Ctrl("OUTFALL_ID").Value = ReturnNextID (objOutfallsRS, "OUTFALL_ID") 'Set control value 'to Function return value
Set objEFP1Ctrl = Nothing 'Free objects
Set objEditForm = Nothing
Set objOutfallsRS = Nothing
End Sub
Function ReturnNextID(objOutfallsRS, strFieldName)
Dim intMaxVal
objOutfallsRS.MoveFirst 'Move to first record
intMaxVal = CInt(objOutfallsRS.Fields(strFieldName).Value) 'Set
'max value
Dim intCurrVal
While Not objOutfallsRS.EOF 'Loop to find\update max value
intCurrVal = CInt(objOutfallsRS.Fields(strFieldName).Value)
If (intCurrVal > intMaxVal) Then
intMaxVal = intCurrVal
End If
objOutfallsRS.MoveNext
Wend
ReturnNextID = CStr(intMaxVal + 1) 'Add 1 and coerce string
End Function
|