<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Autofilling extra fields from the&amp;nbsp; results of a dependant list in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/autofilling-extra-fields-from-the-nbsp-results-of/m-p/96252#M727</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am new to ArcPAD Studio and have a similar issue.&amp;nbsp; Is it possible&amp;nbsp;you can connect &amp;nbsp;me to discuss.&amp;nbsp; I need to auto fill some fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option Explicit&lt;/P&gt;&lt;P&gt;'**********************************************************************************&lt;BR /&gt;'THIS IS THE VBS FILE FOR "DEPENDENT LISTS"&lt;/P&gt;&lt;P&gt;'Dependent Lists" are lists that display different sets of choices&lt;BR /&gt;'depending on the value chosen in another list.&lt;/P&gt;&lt;P&gt;'This VBS file needs to be in the same directory as the layer file&lt;BR /&gt;'**********************************************************************************&lt;/P&gt;&lt;P&gt;Sub LoadDependentList (strTargetComboName, strTableName)&lt;/P&gt;&lt;P&gt;'**********************************************************************************&lt;BR /&gt;'Procedure:&amp;nbsp; LoadDependentList &lt;BR /&gt;'Purpose:&amp;nbsp;Puts a filtered set of list values into a combobox&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;based on the value of another combobox.&lt;BR /&gt;'Arguments:&amp;nbsp;strTargetComboName - the name of the combobox to receive the new list&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;strTableName - the full name of the table containing the "Master" list of values&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if its in same directory as edit layer then the path can be omitted&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(assumes the table has 3 fields: field1 - the field to filter on;&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;field2 - the combobox value; field3 - the combobox text)&lt;/P&gt;&lt;P&gt;'**********************************************************************************&lt;/P&gt;&lt;P&gt;Dim rs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'recordset to open the table containing values to go into target combobox&lt;BR /&gt;Dim strFilter&amp;nbsp;&amp;nbsp;&amp;nbsp;'the value of the ComboBox that has triggered the OnSelChange event&lt;BR /&gt;Dim strFieldName&amp;nbsp;&amp;nbsp;'the name of the field to filter on&lt;BR /&gt;Dim strSearch&lt;BR /&gt;Dim lngFound&lt;BR /&gt;Dim lngBM&lt;BR /&gt;Dim cboFilter&lt;BR /&gt;Dim pge&lt;BR /&gt;Dim strValueField&lt;BR /&gt;Dim strTextField&lt;/P&gt;&lt;P&gt;If "" &amp;amp; strTableName = "" Then&lt;BR /&gt;&amp;nbsp;Exit Sub&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;Set cboFilter=thisevent.object&lt;BR /&gt;Set pge=cboFilter.parent&lt;BR /&gt;strFilter=cboFilter.value&lt;BR /&gt;'strFilter=pge.controls("cboFeature").value&lt;BR /&gt;'msgbox strFilter&lt;BR /&gt;Set rs=Application.CreateAppObject("recordset")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If instr(strTableName, "\")=0 Then&lt;BR /&gt;'if the table name does not contain a backslash character then&lt;BR /&gt;'it does not contain the path to the table, so we assume its in the&lt;BR /&gt;'same directory as the layer being edited - call the LayerPath function&lt;BR /&gt;'to get the directory the table is located in&lt;BR /&gt;&amp;nbsp;strTableName = LayerPath &amp;amp; strTableName&lt;BR /&gt;End If&lt;BR /&gt;On Error Resume Next&lt;BR /&gt;err.clear&lt;BR /&gt;rs.open(strTableName)&lt;BR /&gt;If err.number&amp;lt;&amp;gt;0 Then&lt;BR /&gt;&amp;nbsp;msgbox "Cannot open Table " &amp;amp; strTableName&lt;BR /&gt;&amp;nbsp;Set rs=Nothing&lt;BR /&gt;&amp;nbsp;Set cboFilter=Nothing&lt;BR /&gt;&amp;nbsp;Set pge=Nothing&lt;BR /&gt;&amp;nbsp;Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;strFieldName=rs.fields.item(1).name&lt;BR /&gt;'msgbox strFieldName&lt;BR /&gt;'msgbox LayerPath&lt;BR /&gt;strSearch="[" &amp;amp; strFieldName &amp;amp; "]=""" &amp;amp; strFilter &amp;amp; """"&lt;BR /&gt;strValueField = rs.fields(2).name&lt;BR /&gt;strTextField = rs.fields(3).name&lt;BR /&gt;pge.controls(strTargetComboName).additem "",""&lt;BR /&gt;pge.controls(strTargetComboName).clear&lt;/P&gt;&lt;P&gt;'record find loop not needed - see AddItemsFromTable method below, with optional filter argument&lt;BR /&gt;'correction, loop is needed, I'm sick of trying to get the AddItemsFromTable method to work with a filter argument&lt;BR /&gt;lngFound=rs.find(strSearch)&lt;BR /&gt;While lngfound&amp;gt;0&lt;BR /&gt;&amp;nbsp; lngBM=rs.bookmark&lt;BR /&gt;&amp;nbsp; pge.controls(strTargetComboName).additem rs.fields(2),rs.fields(3)&lt;BR /&gt;&amp;nbsp; lngFound=rs.find(strSearch,,lngBM)&lt;BR /&gt;Wend&lt;BR /&gt;'stop&lt;BR /&gt;rs.close&lt;BR /&gt;'cant get this to work&lt;BR /&gt;'pge.controls(strTargetComboName).AddItemsFromTable strTableName, strValueField, strTextField, strSearch&lt;/P&gt;&lt;P&gt;Set rs=Nothing&lt;BR /&gt;Set pge=Nothing&lt;BR /&gt;Set cboFilter=Nothing&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;Function LayerPath&lt;BR /&gt;'returns the path of the edit layer&lt;BR /&gt;Dim lyr&lt;BR /&gt;Dim strPath&lt;/P&gt;&lt;P&gt;Set lyr=application.map.SelectionLayer&amp;nbsp;&amp;nbsp;'1 is the editable points layer&lt;BR /&gt;strPath = lyr.FilePath&lt;BR /&gt;strPath=left(strPath,InstrRev(strPath,"\",-1,1))&lt;BR /&gt;LayerPath=strPath &lt;BR /&gt;End Function&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Jun 2017 00:56:56 GMT</pubDate>
    <dc:creator>LiLAC_Services__Trevor_Alfred_</dc:creator>
    <dc:date>2017-06-22T00:56:56Z</dc:date>
    <item>
      <title>Autofilling extra fields from the  results of a dependant list</title>
      <link>https://community.esri.com/t5/arcpad-questions/autofilling-extra-fields-from-the-nbsp-results-of/m-p/96250#M725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I'm working on a vegetation form which allows the user to enter records of plant species, with multiple species (entries) per site. The data is stored in a dbf file. I allow the user to select plant names from combobox lists. Because the list is very large, I have a combobox for Genus, which when selected, calls a dependant list (via a Function) of species within that genus. Genus and species appear in separate fields on the form. There is also a unique code number (an integer) that represents each plant species (ie Genus and species form the full plant name). What I would like to do is to be able to get the unique code number to be show in another field on the form apon selection of the species in teh dependant list. My code, which is called from the OnSelChange event in the Genus combobox on my form is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Function UpdateCombo2(cmb1value)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'This function is for a dependant list for species, once genus has been selected&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Dim combo2, instPath, DispName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 'on Error Resume Next &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; instPath="P:\Work\SSD\Users\Huxtac\ArcPad Stuff\Veg_16\"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set combo2 = layer.Forms("FrmNewSpecies").Pages("PgNewSpp2").Controls("CboSpecies")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; combo2.Clear&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; combo2.AddItemsFromTable instPath &amp;amp; "Species_Dependant.DBF", "SP_TEXT", "SP_VALUE", "[GEN_VALUE] =""" &amp;amp; cmb1value &amp;amp; """" &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; If err.Number &amp;lt;&amp;gt; 0 Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; 'Msgbox "You forgot to edit the DependComboApplet.vbs file and change the value of instPath!!!"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 'err.Clear&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; end&amp;nbsp; if&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm assuming that I need another field in the source file for the dependant list (which is called "Species_Dependant.DBF") which contains the unique codes for the Genus/Species name, which can somehow be used to populate a code field in my form.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone help with this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Feb 2011 23:10:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/autofilling-extra-fields-from-the-nbsp-results-of/m-p/96250#M725</guid>
      <dc:creator>CharlesHuxtable</dc:creator>
      <dc:date>2011-02-03T23:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: Autofilling extra fields from the  results of a dependant list</title>
      <link>https://community.esri.com/t5/arcpad-questions/autofilling-extra-fields-from-the-nbsp-results-of/m-p/96251#M726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Charles, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is one way of doing it if you are still looking for a response.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Sub GetGenusValue&lt;BR /&gt;&lt;BR /&gt;Dim objForm, objPage, genusValue, genusText&lt;BR /&gt;Set objForm = Application.Applets("fillForm").Forms("FORM1")&lt;BR /&gt;Set objPage = objForm.Pages("PAGE1")&lt;BR /&gt;genusValue = objPage.Controls("cboGenus").Value&lt;BR /&gt;genusText = objPage.Controls("cboGenus").Text&lt;BR /&gt;'MsgBox genusValue &amp;amp; " " &amp;amp; genusText&lt;BR /&gt;&lt;BR /&gt;Call GetSpeciesValue(genusValue,objPage)&lt;BR /&gt;&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;Sub GetSpeciesValue(genusValue,objPage)&lt;BR /&gt;&lt;BR /&gt;objPage.Controls("cboSpecies").Clear&lt;BR /&gt;&lt;BR /&gt;Dim objRS&lt;BR /&gt;Set objRS = Application.CreateAppObject("RecordSet")&lt;BR /&gt;objRS.Open(preferences.properties("AppletsPath") &amp;amp; "\Species.dbf")&lt;BR /&gt;objRS.MoveFirst&lt;BR /&gt;&lt;BR /&gt;Call objPage.Controls("cboSpecies").AddItemsFromTable(preferences.properties("AppletsPath") &amp;amp; "\Species.dbf", "Species", "Species", ("[GID]= " &amp;amp; genusValue))&lt;BR /&gt;&lt;BR /&gt;objRS.Close&lt;BR /&gt;&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Gareth&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Feb 2011 01:33:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/autofilling-extra-fields-from-the-nbsp-results-of/m-p/96251#M726</guid>
      <dc:creator>GarethWalters</dc:creator>
      <dc:date>2011-02-14T01:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Autofilling extra fields from the  results of a dependant list</title>
      <link>https://community.esri.com/t5/arcpad-questions/autofilling-extra-fields-from-the-nbsp-results-of/m-p/96252#M727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am new to ArcPAD Studio and have a similar issue.&amp;nbsp; Is it possible&amp;nbsp;you can connect &amp;nbsp;me to discuss.&amp;nbsp; I need to auto fill some fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option Explicit&lt;/P&gt;&lt;P&gt;'**********************************************************************************&lt;BR /&gt;'THIS IS THE VBS FILE FOR "DEPENDENT LISTS"&lt;/P&gt;&lt;P&gt;'Dependent Lists" are lists that display different sets of choices&lt;BR /&gt;'depending on the value chosen in another list.&lt;/P&gt;&lt;P&gt;'This VBS file needs to be in the same directory as the layer file&lt;BR /&gt;'**********************************************************************************&lt;/P&gt;&lt;P&gt;Sub LoadDependentList (strTargetComboName, strTableName)&lt;/P&gt;&lt;P&gt;'**********************************************************************************&lt;BR /&gt;'Procedure:&amp;nbsp; LoadDependentList &lt;BR /&gt;'Purpose:&amp;nbsp;Puts a filtered set of list values into a combobox&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;based on the value of another combobox.&lt;BR /&gt;'Arguments:&amp;nbsp;strTargetComboName - the name of the combobox to receive the new list&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;strTableName - the full name of the table containing the "Master" list of values&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if its in same directory as edit layer then the path can be omitted&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(assumes the table has 3 fields: field1 - the field to filter on;&lt;BR /&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;field2 - the combobox value; field3 - the combobox text)&lt;/P&gt;&lt;P&gt;'**********************************************************************************&lt;/P&gt;&lt;P&gt;Dim rs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'recordset to open the table containing values to go into target combobox&lt;BR /&gt;Dim strFilter&amp;nbsp;&amp;nbsp;&amp;nbsp;'the value of the ComboBox that has triggered the OnSelChange event&lt;BR /&gt;Dim strFieldName&amp;nbsp;&amp;nbsp;'the name of the field to filter on&lt;BR /&gt;Dim strSearch&lt;BR /&gt;Dim lngFound&lt;BR /&gt;Dim lngBM&lt;BR /&gt;Dim cboFilter&lt;BR /&gt;Dim pge&lt;BR /&gt;Dim strValueField&lt;BR /&gt;Dim strTextField&lt;/P&gt;&lt;P&gt;If "" &amp;amp; strTableName = "" Then&lt;BR /&gt;&amp;nbsp;Exit Sub&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;Set cboFilter=thisevent.object&lt;BR /&gt;Set pge=cboFilter.parent&lt;BR /&gt;strFilter=cboFilter.value&lt;BR /&gt;'strFilter=pge.controls("cboFeature").value&lt;BR /&gt;'msgbox strFilter&lt;BR /&gt;Set rs=Application.CreateAppObject("recordset")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If instr(strTableName, "\")=0 Then&lt;BR /&gt;'if the table name does not contain a backslash character then&lt;BR /&gt;'it does not contain the path to the table, so we assume its in the&lt;BR /&gt;'same directory as the layer being edited - call the LayerPath function&lt;BR /&gt;'to get the directory the table is located in&lt;BR /&gt;&amp;nbsp;strTableName = LayerPath &amp;amp; strTableName&lt;BR /&gt;End If&lt;BR /&gt;On Error Resume Next&lt;BR /&gt;err.clear&lt;BR /&gt;rs.open(strTableName)&lt;BR /&gt;If err.number&amp;lt;&amp;gt;0 Then&lt;BR /&gt;&amp;nbsp;msgbox "Cannot open Table " &amp;amp; strTableName&lt;BR /&gt;&amp;nbsp;Set rs=Nothing&lt;BR /&gt;&amp;nbsp;Set cboFilter=Nothing&lt;BR /&gt;&amp;nbsp;Set pge=Nothing&lt;BR /&gt;&amp;nbsp;Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;strFieldName=rs.fields.item(1).name&lt;BR /&gt;'msgbox strFieldName&lt;BR /&gt;'msgbox LayerPath&lt;BR /&gt;strSearch="[" &amp;amp; strFieldName &amp;amp; "]=""" &amp;amp; strFilter &amp;amp; """"&lt;BR /&gt;strValueField = rs.fields(2).name&lt;BR /&gt;strTextField = rs.fields(3).name&lt;BR /&gt;pge.controls(strTargetComboName).additem "",""&lt;BR /&gt;pge.controls(strTargetComboName).clear&lt;/P&gt;&lt;P&gt;'record find loop not needed - see AddItemsFromTable method below, with optional filter argument&lt;BR /&gt;'correction, loop is needed, I'm sick of trying to get the AddItemsFromTable method to work with a filter argument&lt;BR /&gt;lngFound=rs.find(strSearch)&lt;BR /&gt;While lngfound&amp;gt;0&lt;BR /&gt;&amp;nbsp; lngBM=rs.bookmark&lt;BR /&gt;&amp;nbsp; pge.controls(strTargetComboName).additem rs.fields(2),rs.fields(3)&lt;BR /&gt;&amp;nbsp; lngFound=rs.find(strSearch,,lngBM)&lt;BR /&gt;Wend&lt;BR /&gt;'stop&lt;BR /&gt;rs.close&lt;BR /&gt;'cant get this to work&lt;BR /&gt;'pge.controls(strTargetComboName).AddItemsFromTable strTableName, strValueField, strTextField, strSearch&lt;/P&gt;&lt;P&gt;Set rs=Nothing&lt;BR /&gt;Set pge=Nothing&lt;BR /&gt;Set cboFilter=Nothing&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;Function LayerPath&lt;BR /&gt;'returns the path of the edit layer&lt;BR /&gt;Dim lyr&lt;BR /&gt;Dim strPath&lt;/P&gt;&lt;P&gt;Set lyr=application.map.SelectionLayer&amp;nbsp;&amp;nbsp;'1 is the editable points layer&lt;BR /&gt;strPath = lyr.FilePath&lt;BR /&gt;strPath=left(strPath,InstrRev(strPath,"\",-1,1))&lt;BR /&gt;LayerPath=strPath &lt;BR /&gt;End Function&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 00:56:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/autofilling-extra-fields-from-the-nbsp-results-of/m-p/96252#M727</guid>
      <dc:creator>LiLAC_Services__Trevor_Alfred_</dc:creator>
      <dc:date>2017-06-22T00:56:56Z</dc:date>
    </item>
  </channel>
</rss>

