<?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: Populate 2 Attributes based on one Value in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/populate-2-attributes-based-on-one-value/m-p/301220#M2196</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured out a quick and easy solution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Sub InitialiseGPSID
'Do any form initialization in this sub
 Dim objEFPageOneControls, objEditForm
 Set objEditForm = ThisEvent.Object 
 Set objEFPageOneControls = objEditForm.Pages("PAGE1").Controls
&amp;nbsp; 
 'Initialization for form in any mode
 'Disable the GPS ID edit box

&amp;nbsp; objEFPageOneControls("txt_GPSID").Enabled = False


&amp;nbsp; 'Initialization for form when adding new records

&amp;nbsp; If objEditForm.Mode = 3 Then ' Mode 3 is used when creating a new feature.
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Get the Fence Points layer's recordset (to pass into the ReturnNextID function)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim objUniqueID

&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objUniqueID = Layer.Records

 if ReturnNextID (objUniqueID, "USERNUMBER") = 1 then
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Update the Tree ID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objEFPageOneControls("txt_GPSID").Value = ReturnNextID (objUniqueID, "USERNUMBER") + 10000
 objEFPageOneControls("txt_AssetID").Value = ReturnNextID (objUniqueID, "USERNUMBER") + 10000
 else
&amp;nbsp; objEFPageOneControls("txt_GPSID").Value = ReturnNextID (objUniqueID, "USERNUMBER")
&amp;nbsp; objEFPageOneControls("txt_AssetID").Value = ReturnNextID (objUniqueID, "USERNUMBER")
 end if

&amp;nbsp; End If
&amp;nbsp; 'Free objects
&amp;nbsp; Set objEFPageOneControls = Nothing
&amp;nbsp; Set objEditForm = Nothing
&amp;nbsp; Set objUniqueID = Nothing
End Sub

'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'Also write the function ReturnNextID that is called by InitializeForm. 
 
Function ReturnNextID (objRS, strFieldName)
&amp;nbsp; Dim intMax

&amp;nbsp; 'Get the first record
&amp;nbsp; objRS.MoveFirst

&amp;nbsp; 'Initialize the max value to the first record
&amp;nbsp; intMax = CInt(objRS.Fields(strFieldName).Value)

&amp;nbsp; 'Loop through the records, updating the max value if necessary
&amp;nbsp; Dim intCurrVal

&amp;nbsp; While Not objRS.EOF

&amp;nbsp;&amp;nbsp;&amp;nbsp; intCurrVal = CInt(objRS.Fields(strFieldName).Value)

&amp;nbsp;&amp;nbsp;&amp;nbsp; If (intCurrVal &amp;gt; intMax) Then

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intMax = intCurrVal

&amp;nbsp;&amp;nbsp;&amp;nbsp; End If

&amp;nbsp;&amp;nbsp;&amp;nbsp; objRS.MoveNext
&amp;nbsp; Wend

&amp;nbsp; ReturnNextID = intMax + 1

End Function


'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The text in the yellow links to a invisible text box in the form then saves the value to the field in the Shapefile.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;not a clear work around but does for now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:18:54 GMT</pubDate>
    <dc:creator>AndrewHansford</dc:creator>
    <dc:date>2021-12-12T16:18:54Z</dc:date>
    <item>
      <title>Populate 2 Attributes based on one Value</title>
      <link>https://community.esri.com/t5/arcpad-questions/populate-2-attributes-based-on-one-value/m-p/301219#M2195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am working on a project in ArcPad 8 SP3.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a Shapefile with to fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;UserNumber (Long Integer)&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;UserText3 (Text Field)&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;BR /&gt;&lt;SPAN&gt;Below is my Code that i have created to autogenerate a Unique ID and my Text_box that it relates to will store that value that is returned to UserNumber. How would I go about adding that value directly to the Attribute table for UserText3?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; 

Sub InitialiseGPSID
'Do any form initialization in this sub
 Dim objEFPageOneControls, objEditForm
 Set objEditForm = ThisEvent.Object 
 Set objEFPageOneControls = objEditForm.Pages("PAGE1").Controls
&amp;nbsp; 
 'Initialization for form in any mode
 'Disable the GPS ID edit box

&amp;nbsp; objEFPageOneControls("txt_GPSID").Enabled = False


&amp;nbsp; 'Initialization for form when adding new records

&amp;nbsp; If objEditForm.Mode = 3 Then ' Mode 3 is used when creating a new feature.
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Get the Fence Points layer's recordset (to pass into the ReturnNextID function)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim objUniqueID

&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objUniqueID = Layer.Records

 if ReturnNextID (objUniqueID, "USERNUMBER") = 1 then
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Update the Tree ID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objEFPageOneControls("txt_GPSID").Value = ReturnNextID (objUniqueID, "USERNUMBER") + 10000
 else
&amp;nbsp; objEFPageOneControls("txt_GPSID").Value = ReturnNextID (objUniqueID, "USERNUMBER")
 end if

&amp;nbsp; End If
&amp;nbsp; 'Free objects
&amp;nbsp; Set objEFPageOneControls = Nothing
&amp;nbsp; Set objEditForm = Nothing
&amp;nbsp; Set objUniqueID = Nothing
End Sub

'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'Also write the function ReturnNextID that is called by InitializeForm. 
 
Function ReturnNextID (objRS, strFieldName)
&amp;nbsp; Dim intMax

&amp;nbsp; 'Get the first record
&amp;nbsp; objRS.MoveFirst

&amp;nbsp; 'Initialize the max value to the first record
&amp;nbsp; intMax = CInt(objRS.Fields(strFieldName).Value)

&amp;nbsp; 'Loop through the records, updating the max value if necessary
&amp;nbsp; Dim intCurrVal

&amp;nbsp; While Not objRS.EOF

&amp;nbsp;&amp;nbsp;&amp;nbsp; intCurrVal = CInt(objRS.Fields(strFieldName).Value)

&amp;nbsp;&amp;nbsp;&amp;nbsp; If (intCurrVal &amp;gt; intMax) Then

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intMax = intCurrVal

&amp;nbsp;&amp;nbsp;&amp;nbsp; End If

&amp;nbsp;&amp;nbsp;&amp;nbsp; objRS.MoveNext
&amp;nbsp; Wend

&amp;nbsp; ReturnNextID = intMax + 1

End Function


'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 22:44:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/populate-2-attributes-based-on-one-value/m-p/301219#M2195</guid>
      <dc:creator>AndrewHansford</dc:creator>
      <dc:date>2010-06-24T22:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Populate 2 Attributes based on one Value</title>
      <link>https://community.esri.com/t5/arcpad-questions/populate-2-attributes-based-on-one-value/m-p/301220#M2196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured out a quick and easy solution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Sub InitialiseGPSID
'Do any form initialization in this sub
 Dim objEFPageOneControls, objEditForm
 Set objEditForm = ThisEvent.Object 
 Set objEFPageOneControls = objEditForm.Pages("PAGE1").Controls
&amp;nbsp; 
 'Initialization for form in any mode
 'Disable the GPS ID edit box

&amp;nbsp; objEFPageOneControls("txt_GPSID").Enabled = False


&amp;nbsp; 'Initialization for form when adding new records

&amp;nbsp; If objEditForm.Mode = 3 Then ' Mode 3 is used when creating a new feature.
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Get the Fence Points layer's recordset (to pass into the ReturnNextID function)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim objUniqueID

&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objUniqueID = Layer.Records

 if ReturnNextID (objUniqueID, "USERNUMBER") = 1 then
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Update the Tree ID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objEFPageOneControls("txt_GPSID").Value = ReturnNextID (objUniqueID, "USERNUMBER") + 10000
 objEFPageOneControls("txt_AssetID").Value = ReturnNextID (objUniqueID, "USERNUMBER") + 10000
 else
&amp;nbsp; objEFPageOneControls("txt_GPSID").Value = ReturnNextID (objUniqueID, "USERNUMBER")
&amp;nbsp; objEFPageOneControls("txt_AssetID").Value = ReturnNextID (objUniqueID, "USERNUMBER")
 end if

&amp;nbsp; End If
&amp;nbsp; 'Free objects
&amp;nbsp; Set objEFPageOneControls = Nothing
&amp;nbsp; Set objEditForm = Nothing
&amp;nbsp; Set objUniqueID = Nothing
End Sub

'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'Also write the function ReturnNextID that is called by InitializeForm. 
 
Function ReturnNextID (objRS, strFieldName)
&amp;nbsp; Dim intMax

&amp;nbsp; 'Get the first record
&amp;nbsp; objRS.MoveFirst

&amp;nbsp; 'Initialize the max value to the first record
&amp;nbsp; intMax = CInt(objRS.Fields(strFieldName).Value)

&amp;nbsp; 'Loop through the records, updating the max value if necessary
&amp;nbsp; Dim intCurrVal

&amp;nbsp; While Not objRS.EOF

&amp;nbsp;&amp;nbsp;&amp;nbsp; intCurrVal = CInt(objRS.Fields(strFieldName).Value)

&amp;nbsp;&amp;nbsp;&amp;nbsp; If (intCurrVal &amp;gt; intMax) Then

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intMax = intCurrVal

&amp;nbsp;&amp;nbsp;&amp;nbsp; End If

&amp;nbsp;&amp;nbsp;&amp;nbsp; objRS.MoveNext
&amp;nbsp; Wend

&amp;nbsp; ReturnNextID = intMax + 1

End Function


'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The text in the yellow links to a invisible text box in the form then saves the value to the field in the Shapefile.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;not a clear work around but does for now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:18:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/populate-2-attributes-based-on-one-value/m-p/301220#M2196</guid>
      <dc:creator>AndrewHansford</dc:creator>
      <dc:date>2021-12-12T16:18:54Z</dc:date>
    </item>
  </channel>
</rss>

