<?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: Select By Attributes with VBScript in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228239#M1685</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Probably&amp;nbsp; RecordSet::Find Method doesn't work for AXF file.&amp;nbsp; I don't have an axf file to test with, but you can try to use this code with your file to see if it works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Dim objLayer, objRS, objRect, myQuery, myRec, myValue Set objLayer=application.map.layers("My Layer Name") myValue = 357799 Set objRS=objLayer.records If (Not objRS Is Nothing) Then&amp;nbsp; objRS.MoveFirst&amp;nbsp; For i = 0 To objRS.RecordCount - 1 &amp;nbsp; If objRS.Fields("FieldName").Value = myValue Then &amp;nbsp;&amp;nbsp; myRec = i+1 &amp;nbsp; End If &amp;nbsp; objRS.MoveNext&amp;nbsp; Next End If&amp;nbsp; If (myRec &amp;gt; 0) Then&amp;nbsp; 'Zoom to feature&amp;nbsp; Set objRect=objRS.Fields.Shape.Extent&amp;nbsp; Call objRect.ScaleRectangle(0.5)&amp;nbsp; Application.Map.Extent = objRect&amp;nbsp; Application.Map.Refresh Else&amp;nbsp; msgbox "Feature Not Found!" End If Set objRect = Nothing Set objLyr = Nothing Set objRS = Nothing Set pDS = Nothing&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 May 2012 15:16:23 GMT</pubDate>
    <dc:creator>ThaiTruong</dc:creator>
    <dc:date>2012-05-31T15:16:23Z</dc:date>
    <item>
      <title>Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228231#M1677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to programmatically select features by attributes&amp;nbsp; using vbscript?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have introduced a unique identifier (not OID) to the attribute table that I need to search for, but i can't seem to find a method to do so.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know this seems like a very simple question, but I have failed to find a good source of documentation pertaining to ArcPad and vbscript. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If anyone knows of such a source, please share.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 13:35:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228231#M1677</guid>
      <dc:creator>SandraDema</dc:creator>
      <dc:date>2012-05-22T13:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228232#M1678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Sandra,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have checked out your data from ArcMap using the ArcPad Data Manager, your project should already have a set of automatically generated Query Forms. These forms are the same as your Edit Forms, but are specifically used to search your data. On the Browse Toolbar (pointy hand on the globe) select the Find Tool (binoculars) to open your Query Forms. Here is an example from the Riverside Sample Dataset:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]14539[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From here I can enter the ID of the Poles Record I am searching for and tap OK to see my Results Tab:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]14540[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I can select my record and use the tools on the right-hand side to open the edit form, zoom to the record or navigate to the record. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All without writing a single line of code (my favorite!!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For more info - check out this &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcpad/10.0/help/index.html#/Overview_of_querying_your_data/00s1000000q6000000/"&gt;help article&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;HTH&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hannah Ferrier&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 23:38:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228232#M1678</guid>
      <dc:creator>HannahFerrier</dc:creator>
      <dc:date>2012-05-22T23:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228233#M1679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks so much for the reply. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I understand that I can use the built-in query feature. What I need is a way that I can query the data without user interaction. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know that I can use SelectXY to search spatially when I have the XY coordinates. I'm sure there is a way to automate the query by attributes feature, I'm just coming up empty handed.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 12:50:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228233#M1679</guid>
      <dc:creator>SandraDema</dc:creator>
      <dc:date>2012-05-23T12:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228234#M1680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Since you have unique values in a field, you can try to use &lt;/SPAN&gt;&lt;STRONG&gt;RecordSet::Find&lt;/STRONG&gt;&lt;SPAN&gt; method to find a record that meets your search criteria.&amp;nbsp; The expression is a string in form: &lt;/SPAN&gt;&lt;STRONG style="font-style: italic;"&gt;"[FIELD] = VALUE"&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There will be one result is returned at each time you call the Find method.&amp;nbsp; And a return value of 0 tells you that no record was found.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 18:41:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228234#M1680</guid>
      <dc:creator>ThaiTruong</dc:creator>
      <dc:date>2012-05-23T18:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228235#M1681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This code snippet will help you get started.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this example, it finds feature that [FieldName]="Lookup Value" from "My Layer Name", then zooms to that feature.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Sub SelectAndZoomTo
Dim objLayer, objRS, objRect, myQuery, myRec, myValue
Set objLayer=application.map.layers("My Layer Name")
myValue = "Lookup Value"
Set objRS=objLayer.records
myQuery = "[FieldName]= """ &amp;amp; myValue &amp;amp; """
myRec = objRS.Find(myQuery)

'If feature is found
If (myRec &amp;gt; 0) Then
 objRS.movefirst
 objRS.move(myRec-1)
 Set objRect=objRS.Fields.Shape.Extent
 Map.Extent=objRect
'If feture is Not found
Else
 msgbox "Feature NOT Found!"
End If
Map.Refresh
End Sub
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:06:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228235#M1681</guid>
      <dc:creator>ThaiTruong</dc:creator>
      <dc:date>2021-12-11T11:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228236#M1682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When I run your code, I get error 800A01BD - "Object doesn't support this action" at line&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;myQuery = "[FieldName]= " &amp;amp; myValue&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (the field is an integer, so I removed the quotes)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I use the same query string in ArcMap, everything works as expected. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2012 13:58:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228236#M1682</guid>
      <dc:creator>SandraDema</dc:creator>
      <dc:date>2012-05-25T13:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228237#M1683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi ssdema, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't see anything wrong with the above code or your expression string!&amp;nbsp; It should center the feature on your map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Just double check to see your layer's name &amp;amp; Field name spelled correctly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 14:28:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228237#M1683</guid>
      <dc:creator>ThaiTruong</dc:creator>
      <dc:date>2012-05-30T14:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228238#M1684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am using axf files. I have read that the Find method does not work with previous versions of ArcPad when utilizing axf files.&amp;nbsp; Could this still be the case (explaining why I am getting this error)?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 12:44:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228238#M1684</guid>
      <dc:creator>SandraDema</dc:creator>
      <dc:date>2012-05-31T12:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228239#M1685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Probably&amp;nbsp; RecordSet::Find Method doesn't work for AXF file.&amp;nbsp; I don't have an axf file to test with, but you can try to use this code with your file to see if it works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Dim objLayer, objRS, objRect, myQuery, myRec, myValue Set objLayer=application.map.layers("My Layer Name") myValue = 357799 Set objRS=objLayer.records If (Not objRS Is Nothing) Then&amp;nbsp; objRS.MoveFirst&amp;nbsp; For i = 0 To objRS.RecordCount - 1 &amp;nbsp; If objRS.Fields("FieldName").Value = myValue Then &amp;nbsp;&amp;nbsp; myRec = i+1 &amp;nbsp; End If &amp;nbsp; objRS.MoveNext&amp;nbsp; Next End If&amp;nbsp; If (myRec &amp;gt; 0) Then&amp;nbsp; 'Zoom to feature&amp;nbsp; Set objRect=objRS.Fields.Shape.Extent&amp;nbsp; Call objRect.ScaleRectangle(0.5)&amp;nbsp; Application.Map.Extent = objRect&amp;nbsp; Application.Map.Refresh Else&amp;nbsp; msgbox "Feature Not Found!" End If Set objRect = Nothing Set objLyr = Nothing Set objRS = Nothing Set pDS = Nothing&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 15:16:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228239#M1685</guid>
      <dc:creator>ThaiTruong</dc:creator>
      <dc:date>2012-05-31T15:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228240#M1686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I did a little playing around with the code you provided and was able to get the search function to work the way i needed it to. i have included this code below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was a bit hesitant at first. The field crew will check out approximately 1500 features at a time. I thought looping though all of those features would be very slow.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As it turns out, the code runs relatively quickly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so much to everyone who contributed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Function SearchByAttributes(myValue)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim objLayer, objRS, objRect, myQuery, myRec&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set objLayer=application.map.layers("LayerName")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim I&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myRec = 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set objRS=objLayer.records&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; If (Not objRS Is Nothing) Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; objRS.MoveFirst&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; For i = 0 To objRS.RecordCount - 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; If objRS.Fields("FieldName").Value = myValue Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myRec = i+1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit For&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;&amp;nbsp; objRS.MoveNext&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; If (myRec &amp;gt; 0) Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; 'Zoom to feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set objRect=objRS.Fields.Shape.Extent&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call objRect.ScaleRectangle(1.5)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'select feature (feature must be in edit mode for the selection to work)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; objRs.Bookmark = Map.SelectionBookmark&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Application.Map.Extent = objRect&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Application.Map.Refresh&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; msgbox "Feature Not Found!"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set objRect = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set objLayer = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set objRS = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 16:09:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228240#M1686</guid>
      <dc:creator>SandraDema</dc:creator>
      <dc:date>2012-05-31T16:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Select By Attributes with VBScript</title>
      <link>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228241#M1687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great!&amp;nbsp; Glad to see it works for you, Sandra.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 17:21:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/select-by-attributes-with-vbscript/m-p/228241#M1687</guid>
      <dc:creator>ThaiTruong</dc:creator>
      <dc:date>2012-05-31T17:21:32Z</dc:date>
    </item>
  </channel>
</rss>

