<?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: ArcPAD 8 - For Loop Causes Object Required Error in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220266#M1626</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That is strange. No 'blanks' hiding anywhere or uppercase/lowercase issues?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Check your statement objPg("cboNumDBH").Value for its lenght ie.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;MsgBox Len(objPg("cboNumDBH").Value&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try to use an explicit conversion from integer to character using&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strEdtName = "edtDBH" &amp;amp; CChar(counter)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is an error there somewhere. Could you post your apl file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rolf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 Jan 2011 13:26:33 GMT</pubDate>
    <dc:creator>RolfBroch</dc:creator>
    <dc:date>2011-01-31T13:26:33Z</dc:date>
    <item>
      <title>ArcPAD 8 - For Loop Causes Object Required Error</title>
      <link>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220263#M1623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I am initializing some controls on a form, I have a set of edit boxes named edtDBH1, edtDBH2...edtDBH6.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The user selects the number of items to be recorded and my script is supposed to enable the right number of controls and disable the others. To do this I am using a For loop to call a function with parameters for: control to be changed, iteration number and the Boolean value. This way I can recycle the function and use it to disable the remaining controls by using a countdown loop with Boolean value set to false.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The first loop works fine but the second loop does it's job and then throws a VBScript error: Object Required: rfPage...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I am not closing the first loop correctly or somehow the first loop is messing with the object references established at the start.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sub SetNumDBH&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim objPg, numDBH, controlCount&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set objPg = Layers("Tree_Inventory").Forms("EDITFORM").Pages("pgDBH").Controls&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;numDBH = objPg("cboNumDBH").Value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if numDBH = 0 then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MsgBox "DBH Number Not Valid! Check Values!"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Exit Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For controlCount=1 to numDBH&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; call changeEDT(objPg, controlCount, True)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For controlCount = (numDBH+1) to 6&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; call changeEDT(objPg, controlCount, False)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Function changeEDT(byRef rfPage, counter, boolVal)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim strEdtName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strEdtName = "edtDBH" &amp;amp; counter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'MsgBox "Called: bool: " &amp;amp; boolval &amp;amp; " string:" &amp;amp; strEdtName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; rfPage(strEdtName).Enabled = boolval&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; rfPage(strEdtName).Visible = boolval&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-----------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Many Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dennis&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jan 2011 20:23:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220263#M1623</guid>
      <dc:creator>DennisPomo</dc:creator>
      <dc:date>2011-01-26T20:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPAD 8 - For Loop Causes Object Required Error</title>
      <link>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220264#M1624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your message VBScript error: Object Required: indicates that the object you try to retrieve in the statement rfPage(strEdtName).Enabled = boolval does not exist which seems to me that the steEdtName is incorrect. Could be a wrong spelling in your form definition.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try changing the function to trap the error&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Function changeEDT(byRef rfPage, counter, boolVal)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim strEdtName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strEdtName = "edtDBH" &amp;amp; counter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'MsgBox "Called: bool: " &amp;amp; boolval &amp;amp; " string:" &amp;amp; strEdtName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If rfPage(strEdtName) Is Nothing Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MsgBox "Failed with strEdtName = " &amp;amp; strEdtName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rfPage(strEdtName).Enabled = boolval&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rfPage(strEdtName).Visible = boolval&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jan 2011 06:26:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220264#M1624</guid>
      <dc:creator>RolfBroch</dc:creator>
      <dc:date>2011-01-27T06:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPAD 8 - For Loop Causes Object Required Error</title>
      <link>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220265#M1625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Rolf,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a weird one, printing the string that is supposed to contain the controls name reveals that the string is correct. Substituting the string with the actual hard-coded name works but then the loop becomes pointless (it adds an incremental number to the string to access a series of controls).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know what caused this, I got around it by changing the event used to execute the script to onselok and it works. Strange.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dennis&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jan 2011 23:57:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220265#M1625</guid>
      <dc:creator>DennisPomo</dc:creator>
      <dc:date>2011-01-27T23:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPAD 8 - For Loop Causes Object Required Error</title>
      <link>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220266#M1626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That is strange. No 'blanks' hiding anywhere or uppercase/lowercase issues?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Check your statement objPg("cboNumDBH").Value for its lenght ie.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;MsgBox Len(objPg("cboNumDBH").Value&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try to use an explicit conversion from integer to character using&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strEdtName = "edtDBH" &amp;amp; CChar(counter)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is an error there somewhere. Could you post your apl file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rolf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Jan 2011 13:26:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220266#M1626</guid>
      <dc:creator>RolfBroch</dc:creator>
      <dc:date>2011-01-31T13:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPAD 8 - For Loop Causes Object Required Error</title>
      <link>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220267#M1627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Rolf,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The issue seems to be sorted. The final code is the same but the trigger event is different. I think it was something to do with the object returned by the OnValidate function I was initially trying to use.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dennis&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Feb 2011 21:23:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/arcpad-8-for-loop-causes-object-required-error/m-p/220267#M1627</guid>
      <dc:creator>DennisPomo</dc:creator>
      <dc:date>2011-02-03T21:23:27Z</dc:date>
    </item>
  </channel>
</rss>

