Did you figure this out? I'm looking to do something similar.
'autopopulate a field based on entry in another field Sub AutoPop Dim objDBF, strCode, strTest, i , strObs, pageGen 'pageGen = Layers("SignsTest3").Forms("EDITFORM").Pages("General") 'SignsTest3 is the layer strObs= Layers("SignsTest3").Forms("EDITFORM").Pages("General").Controls("domDescription").value 'get value user selected in domDescription field Set objDBF = Application.CreateAppObject("recordset") objDBF.Open "C:\Users\mbishopp\Documents\SignsTestData1\dbase\Example.dbf", 1 'open the external DBF table <--this should probably be placed somewhere else, like with the apl or axf, but I was just experimenting at the time. objDBF.MoveFirst For i=0 to objDBF.RecordCount-1 'loop through DBF list until end of list If strObs=objDBF.Fields("Descriptio").Value then 'compare selected obs value form with 1st CODE value from table strTest = objDBF.Fields("SignType").Value 'if form value = CODE value then store associated TEST value in variable MsgBox(strTest) Layers("SignsTest3").Forms("EDITFORM").Pages("General").Controls("tbSignType").value = strTest 'Populate the tbSignType control with var strTest Layers("SignsTest3").Forms("EDITFORM").Pages("General").Controls("tbDescription").value = strObs 'Populate the tbDescription control with var strObs 'ThisEvent.Object.value=strTest 'enter stored variable into text box on form <--didn't use this, legacy from other user that I stole this from Else End If objDBF.MoveNext 'goto next record in DBF table Next objDBF.Close 'close DBF table Set objDBF = Nothing End Sub
<ArcPad> <LAYER name="test.shp"> <FORMS> <EDITFORM name="EDITFORM" caption="test" width="130" height="130" picturepagevisible="false" attributespagevisible="false" symbologypagevisible="false" geographypagevisible="false" required="false"> <PAGE name="PAGE1" caption="test"> <COMBOBOX name="NAME" x="32" y="22" width="94" height="100" defaultvalue="" listtable="list.dbf" listvaluefield="NAME" listtextfield="NAME" onselok="Call UpdateNameList()" tooltip="" tabstop="true" border="true" sip="true" limittolist="false" sort="false" field="NAME"/> <COMBOBOX name="DESC" x="32" y="22" width="94" height="100" defaultvalue="" listtable="list.dbf" listvaluefield="DESC" listtextfield="DESC" onselok="Call UpdateDescList()" tooltip="" tabstop="true" border="true" sip="true" limittolist="false" sort="false" field="SPECIES"/> </PAGE> </EDITFORM> </FORMS> <SCRIPT src="Functions.vbs" language="vbscript"/> </LAYER> </ArcPad>
Sub UpdateNameList() Dim pForm Set pForm = ThisEvent.Object.Parent pForm.Controls("NAME").ListIndex = pForm.Controls("DESC").ListIndex Set pForm = Nothing End Sub Sub UpdateDescList() Dim pForm Set pForm = ThisEvent.Object.Parent pForm.Controls("DESC").ListIndex = pForm.Controls("NAME").ListIndex Set pForm = Nothing End Sub
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.