<?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: Programming automating tool in VBscipt in ArcPad in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/programming-automating-tool-in-vbscipt-in-arcpad/m-p/254919#M1846</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What event are you calling this Sub from? It may not let you alter the value if it's during the OnUnload event of the form. If that's where it is being called, you might try the OnOK event. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, when I looked up the Layer object in the "Customizing ArcPad" help, and then clicked on the Records Property, it indicates that it's read only, so it may not be possible to use the Records object to do this. It is possible to programmatically update attributes outside of the edit form, but I haven't done this for shapefiles (have done it with SQL for AXF files) so I'm not sure of the exact methods used. You might try doing this while the Edit Form is displayed and just having a text box whose value you update with the code. Then the value will get saved along with the rest of the form's values. If it were me I'd go this route. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Eric&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Mar 2012 18:23:30 GMT</pubDate>
    <dc:creator>EricHajek1</dc:creator>
    <dc:date>2012-03-21T18:23:30Z</dc:date>
    <item>
      <title>Programming automating tool in VBscipt in ArcPad</title>
      <link>https://community.esri.com/t5/arcpad-questions/programming-automating-tool-in-vbscipt-in-arcpad/m-p/254918#M1845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am working on an automating tool for ArcPad for inventory issues on our mobile GIS machine (Trimble GeoXH - Geoexplorer 2008 series - Windows mobile 6.1 and Arcdap 10.0.3) in VBscript. Short description of what the tool is supposed to do: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We have a point shapefile in Arcpad. Everytime when we manually add a point, it automaticaly counts the new ID by clicking on a button in the toolbar. The new ID is the last ID + 1. I succeeded already in looping through the attributes, finding the last ID and calculating a new ID. &lt;span class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;😮&lt;/span&gt; However, I can't add the new calculated ID for the added point in the attribute table :mad: ... It's like I can't open the recordset in edit mode. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Below you find my source code. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anybody kows what I'm doing wrong? Thanks for helping me!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Kris&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My Sourcecode:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sub Test&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim objDBF, strLaatstePaalID, NewPaalNR, NewPaalID, Nummer, PaalCode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Numbre = 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set objLyr = Map.Layers("Palen")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set objDBF = objLyr.Records&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; 'Look for record with the highest ID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; 'ID is text format like 'P_00450'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; objDBF.MoveFirst&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Do Until objDBF.EOF&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PaalCode = objDBF.Fields("PAAL_ID").Value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; If PaalCode &amp;lt;&amp;gt; "" Then 'the new added point (which is the last) has no value in the ID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; If Int(Right(PaalCode,(Len(PaalCode)-2)))&amp;gt;Numbre Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Make an integer of the text code&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Numbre = Int(Right(PaalCode,(Len(PaalCode)-2)))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; objDBF.MoveNext&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; NewPaalNR = Numbre + 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; 'Maak een nieuw text ID with the new numbre&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If NewPaalNR &amp;lt; 10 Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewPaalID = "P_0000" &amp;amp; CStr(NewPaalNR)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf NewPaalNR &amp;lt; 100 Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewPaalID = "P_000" &amp;amp; CStr(NewPaalNR)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf NewPaalNR &amp;lt; 1000 Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewPaalID = "P_00" &amp;amp; CStr(NewPaalNR)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf NewPaalNR &amp;lt; 10000 Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewPaalID = "P_0" &amp;amp; CStr(NewPaalNR)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NewPaalID = "P_" &amp;amp; CStr(NewPaalNR)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MsgBox ("New Id: " &amp;amp; NewPaalID)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; 'go to the new added point&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; objDBF.MoveLast&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; if objDBF.Fields("PAAL_ID").Value ="" Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; 'add the new value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; objDBF.Fields("PAAL_ID").Value = NewPaalID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; objDBF.Update&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; MsgBox("Paal_ID " &amp;amp; NewPaalID &amp;amp; " added in Palen.shp")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; MsgBox("No empty feature added")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; End If &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set objDBF = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2012 12:06:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/programming-automating-tool-in-vbscipt-in-arcpad/m-p/254918#M1845</guid>
      <dc:creator>KrisDe_Coster</dc:creator>
      <dc:date>2012-03-19T12:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Programming automating tool in VBscipt in ArcPad</title>
      <link>https://community.esri.com/t5/arcpad-questions/programming-automating-tool-in-vbscipt-in-arcpad/m-p/254919#M1846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What event are you calling this Sub from? It may not let you alter the value if it's during the OnUnload event of the form. If that's where it is being called, you might try the OnOK event. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, when I looked up the Layer object in the "Customizing ArcPad" help, and then clicked on the Records Property, it indicates that it's read only, so it may not be possible to use the Records object to do this. It is possible to programmatically update attributes outside of the edit form, but I haven't done this for shapefiles (have done it with SQL for AXF files) so I'm not sure of the exact methods used. You might try doing this while the Edit Form is displayed and just having a text box whose value you update with the code. Then the value will get saved along with the rest of the form's values. If it were me I'd go this route. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Eric&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 18:23:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/programming-automating-tool-in-vbscipt-in-arcpad/m-p/254919#M1846</guid>
      <dc:creator>EricHajek1</dc:creator>
      <dc:date>2012-03-21T18:23:30Z</dc:date>
    </item>
  </channel>
</rss>

