Ok here's what I've got.'The purpose of this script is to enable the appropriate ID/NUMBER fields [ASMIS_ID, FEATURE_NUMBER, TRACKING_NUMBER]
'when a given subtype [Site, Feature, IO, Other] is selected, and to hide those ID/NUMBER fields that do not apply with the value "N/A".
'Create a subroutine to be able to pass any feature layer name to the script
Sub PopulateForm(c_sFLayer)
'Create and define Form, Page, and Control
Dim objForm, objPage, objControl
Set objForm = Map.Layers(c_sFLayer).Forms("EDITFORM")
Set objPage = objForm.Pages("DataEntry")
Set objControl = objPage.Controls
'If lblSUBTYPE field value is Site, do the following:
If objControl.Item("lblSUBTYPE").value = "Site" Then
'Enable txtASMIS_ID field
objControl.Item("txtASMIS_ID").Enabled = True
'Disable txtFEATURE_NUMBER field
objControl.Item("txtFEATURE_NUMBER").Enabled = False
'and set value of txtFEATURE_NUMBER field to "N/A"
objControl.Item("txtFEATURE_NUMBER").Value = "N/A"
'Disable txtTRACKING_NUMBER field
objControl.Item("txtTRACKING_NUMBER").Enabled = False
'and set value of txtTRACKING_NUMBER field to "N/A"
objControl.Item("txtTRACKING_NUMBER").Value = "N/A"
'If lblSUBTYPE field value is Feature, do the following:
ElseIf objControl.Item("lblSUBTYPE").value = "Feature" Then
'Enable txtASMIS_ID field
objControl.Item("txtASMIS_ID").Enabled = True
'Enable txtFEATURE_NUMBER field
objControl.Item("txtFEATURE_NUMBER").Enabled = True
'Disable txtTRACKING_NUMBER field
objControl.Item("txtTRACKING_NUMBER").Enabled = False
'and set value of txtTRACKING_NUMBER field to "N/A"
objControl.Item("txtTRACKING_NUMBER").Value = "N/A"
'If lblSUBTYPE field value is IO, do the following:
ElseIf objControl.Item("lblSUBTYPE").value = "IO" Then
'Disable txtASMIS_ID field
objControl.Item("txtASMIS_ID").Enabled = False
'and set value of txtASMIS_ID field to "N/A"
objControl.Item("txtASMIS_ID").Value = "N/A"
'Disable txtFEATURE_NUMBER field
objControl.Item("txtFEATURE_NUMBER").Enabled = False
'and set value of txtFEATURE_NUMBER field to "N/A"
objControl.Item("txtFEATURE_NUMBER").Value = "N/A"
'Enable txtTRACKING_NUMBER field
objControl.Item("txtTRACKING_NUMBER").Enabled = True
'If lblSUBTYPE field value is Other, do the following:
ElseIf objControl.Item("lblSUBTYPE").value = "Other" Then
'Disable txtASMIS_ID field
objControl.Item("txtASMIS_ID").Enabled = False
'and set value of txtASMIS_ID field to "N/A"
objControl.Item("txtASMIS_ID").Value = "N/A"
'Disable txtFEATURE_NUMBER field
objControl.Item("txtFEATURE_NUMBER").Enabled = False
'and set value of txtFEATURE_NUMBER field to "N/A"
objControl.Item("txtFEATURE_NUMBER").Value = "N/A"
'Disable txtTRACKING_NUMBER field
objControl.Item("txtTRACKING_NUMBER").Enabled = False
'and set value of txtTRACKING_NUMBER field to "N/A"
objControl.Item("txtTRACKING_NUMBER").Value = "N/A"
End If
'Free objects
Set objControl = Nothing
Set objPage = Nothing
Set objForm = Nothing
End Sub
In the form properties > OnLoad event, and in the subtype field's properties > OnChange event I called PopulateForm("Line") for the Line layer and so on. In ArcPad when I try to collect a point and the form loads, I receive the following error:Script Error 800A000DError Source UnavailableError Description Unavailable[Line: 1, Column: 1]Source Text UnavailableWhat's missing?Thanks,Kerry