<?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 help with vbscript sub routine to be called with onfeaturecreated event in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/help-with-vbscript-sub-routine-to-be-called-with/m-p/411621#M2985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I'm trying to accomplish is to increment my Edit_Count counter from the event onfeaturecreated in the Layer events, rather than at the close or change of value for each combo box and edit box that makes up my address field (edit_add_combined).&amp;nbsp;&amp;nbsp; I originally had a version of this increment counter embedded in the subroutine which concatenated address field from my edit and combo boxes of bulding num, street direction (N,NE, etc....), st name(Main, Broadway, etc...) and st type (Ave, St, Cir, etc...)... The counter functioned perfectly on the creation of new features.&amp;nbsp; I stored a global variable of the full completed address on the click of OK in the form, which was then compared to the concatenated address on the next created feature, and if they were different, my script reset the counter field to 1, and if they were the same, my script added 1 to the stored global variable of the last created feature.&amp;nbsp; (The idea is to count how many points are collected per property/address parcel.) The issue was this:&amp;nbsp; if they went back to an already created feature to edit anything, and even so much as clicked on one of the edit/combo boxes for the address fields, it would re-calculate the counter field of an already completed and correct feature based on what was created last.&amp;nbsp; SO, i'm trying to put the code that adds 1 to my saved global count variable on the onfeaturecreated event so this wont be an issue with editing existing features.&amp;nbsp; But it will not work the way I have it set up.. I think i'm referencing things incorrectly with it being a Layer event rather than a Form event, but I havent been able to find any help on how to execute and reference editboxes and comboboxes from a particular Form page on a Layer event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code I have that functioned correctly on my Form events to concatenate my address fields and increment my count field based on the comparison of the complete address field to the global variable stored from the previous completed address field.. :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Sub CombineAddFlds()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Dim objControl, objPage, StTyp, AddNum, StDir, StName, EditAddComb, EditCount&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Set objPage = ThisEvent.Object.Parent&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;StTyp = objPage("Combo_StType").Value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;AddNum = objPage("Edit_Addr_Hou2").Value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;StDir = objPage("Combo_St_Dir").Value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;StName = objPage("Combo_StName").Value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;objPage.Controls("Edit_Add_Combined").Value = Addnum + " " + StDir + " " + StName + " " + StTyp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;'added following code to combine sub-routines: "combine addr fields" and "on addr change count increment return to 1"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;If objPage.Controls("Edit_Add_Combined").Value = Application.UserProperties("VarAddComb") Then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objPage.Controls("Edit_Count").Value = (Application.UserProperties("LastCount") + 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else objPage.Controls("Edit_Count").Value = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;End If&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;End Sub&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code is what I have tried calling from the Layer event onfeaturecreated:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Sub OnCreateCounter()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim objPage&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objPage = ThisEvent.Object.Pages("PAGE2").Controls&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If objPage.Controls("Edit_Add_Combined").Value = Application.UserProperties("VarAddComb") Then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objPage.Controls("Edit_Count").Value = (Application.UserProperties("LastCount") + 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else objPage.Controls("Edit_Count").Value = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;End Sub&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 May 2015 22:19:35 GMT</pubDate>
    <dc:creator>BenjaminGrover</dc:creator>
    <dc:date>2015-05-06T22:19:35Z</dc:date>
    <item>
      <title>help with vbscript sub routine to be called with onfeaturecreated event</title>
      <link>https://community.esri.com/t5/arcpad-questions/help-with-vbscript-sub-routine-to-be-called-with/m-p/411621#M2985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I'm trying to accomplish is to increment my Edit_Count counter from the event onfeaturecreated in the Layer events, rather than at the close or change of value for each combo box and edit box that makes up my address field (edit_add_combined).&amp;nbsp;&amp;nbsp; I originally had a version of this increment counter embedded in the subroutine which concatenated address field from my edit and combo boxes of bulding num, street direction (N,NE, etc....), st name(Main, Broadway, etc...) and st type (Ave, St, Cir, etc...)... The counter functioned perfectly on the creation of new features.&amp;nbsp; I stored a global variable of the full completed address on the click of OK in the form, which was then compared to the concatenated address on the next created feature, and if they were different, my script reset the counter field to 1, and if they were the same, my script added 1 to the stored global variable of the last created feature.&amp;nbsp; (The idea is to count how many points are collected per property/address parcel.) The issue was this:&amp;nbsp; if they went back to an already created feature to edit anything, and even so much as clicked on one of the edit/combo boxes for the address fields, it would re-calculate the counter field of an already completed and correct feature based on what was created last.&amp;nbsp; SO, i'm trying to put the code that adds 1 to my saved global count variable on the onfeaturecreated event so this wont be an issue with editing existing features.&amp;nbsp; But it will not work the way I have it set up.. I think i'm referencing things incorrectly with it being a Layer event rather than a Form event, but I havent been able to find any help on how to execute and reference editboxes and comboboxes from a particular Form page on a Layer event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code I have that functioned correctly on my Form events to concatenate my address fields and increment my count field based on the comparison of the complete address field to the global variable stored from the previous completed address field.. :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Sub CombineAddFlds()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Dim objControl, objPage, StTyp, AddNum, StDir, StName, EditAddComb, EditCount&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Set objPage = ThisEvent.Object.Parent&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;StTyp = objPage("Combo_StType").Value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;AddNum = objPage("Edit_Addr_Hou2").Value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;StDir = objPage("Combo_St_Dir").Value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;StName = objPage("Combo_StName").Value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;objPage.Controls("Edit_Add_Combined").Value = Addnum + " " + StDir + " " + StName + " " + StTyp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;'added following code to combine sub-routines: "combine addr fields" and "on addr change count increment return to 1"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;If objPage.Controls("Edit_Add_Combined").Value = Application.UserProperties("VarAddComb") Then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objPage.Controls("Edit_Count").Value = (Application.UserProperties("LastCount") + 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else objPage.Controls("Edit_Count").Value = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;End If&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;End Sub&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code is what I have tried calling from the Layer event onfeaturecreated:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Sub OnCreateCounter()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim objPage&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objPage = ThisEvent.Object.Pages("PAGE2").Controls&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If objPage.Controls("Edit_Add_Combined").Value = Application.UserProperties("VarAddComb") Then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objPage.Controls("Edit_Count").Value = (Application.UserProperties("LastCount") + 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else objPage.Controls("Edit_Count").Value = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;End Sub&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2015 22:19:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/help-with-vbscript-sub-routine-to-be-called-with/m-p/411621#M2985</guid>
      <dc:creator>BenjaminGrover</dc:creator>
      <dc:date>2015-05-06T22:19:35Z</dc:date>
    </item>
  </channel>
</rss>

