Hi all
I'm trying to create a layer definition for a shapefile. when a new shape is created and the editform opens, iwant the area to be automatically placed into an edit control.
i have put the following scripts into the OnLoad event, but when i run arcpad to test the code i get the following error message: "Microsoft VBScript compilation error, Syntax error, [line 1 column 1] Source Text Unavaliable"
what can i do to make it running... tks!!!
Sub UpdateChgCode(pCode)
'Set the value of the last field to pCode
If Map.SelectionLayer Is Nothing Then
Exit Sub
End If
Dim pRS
Set pRS = Map.SelectionLayer.Records
pRS.Bookmark = Map.SelectionBookmark
pRS.Fields(pRS.Fields.Count).Value = pCode
'Get the polygons area
Dim pPoly
Set pPoly = pRs.Fields.Shape
pRs.Fields("Shape_area").Value = pPoly.Area
'Get the edit control and set its value to the area of the new polygon
Dim pAreaControl, pAreaValue
Set pAreaControl = Layers("Historic Foundation").Forms("EditForm").Pages("attributePage").Controls("txtSHAPE_Area")
pAreaControl.Value = pPoly.Area
pRS.Update
Set pRS = Nothing
End Sub