<?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: how to query using text box with vba in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617579#M16553</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;First of all can I correct your English. "Wanna" is not an English word, you should be saying "I want to create a query..." not "I wanna create a query...". OK English lesson over.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In your Shapefile example does the facilities field always end with "--&amp;gt;School" or have you put that in as an explanation? If it does then you &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;want to &lt;/SPAN&gt;&lt;SPAN&gt;create a QueryFilter to return a cursor for all rows that end with that text sequence.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can find a simple example of how to create a cursor in the VBA developers Help under the sample section, the page is called "Perform an attribute query".&amp;nbsp; The WhereClause string can be determined easily by doing the query in ArcMap so you get the syntax correct, it should be something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"FACILITIES" LIKE '%--&amp;gt;School'&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Jun 2011 10:12:37 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2011-06-07T10:12:37Z</dc:date>
    <item>
      <title>how to query using text box with vba</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617578#M16552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear all vba programmer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a shapefile with 3 fields: fid, shape, facilities. I wanna query based on facilities field, by typing 1 or 2 beginning words in the text box. The problem for me is the value in the facilities field don???t have first similar word. for example, I wanna search all of school, so how to query? Below is the example of my data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FID SHAPE FACILITIES&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;0 Point SD Negeri Buket Meutuah --&amp;gt;School&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 Point RS Langsa --&amp;gt;Hospital&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2 Point Bank Syariah Mandiri --&amp;gt;Bank&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3 Point SD Alur Merbau --&amp;gt;School&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4 Point Rumah Sakit cut Meutia --&amp;gt;Hospital&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5 Point Kantor Samsat Langsa --&amp;gt;Police office&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6 Point Mesjid Raya Bujok --&amp;gt;Mosque&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;7 Point MAN Langsa --&amp;gt;School&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;8 Point SMP Negeri 7 Langsa --&amp;gt;School&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;9 Point Kantor Dinas SDA --&amp;gt;Office&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;10 Point BRI Langsa --&amp;gt;Bank&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;11 Point Rumah Sakit Umum Langsa --&amp;gt;Hospital&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;12 Point Pesantren Bustanul Ulum --&amp;gt;School&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;13 Point Kantor Polisi Militer --&amp;gt;Police office&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;14 Point Kantor Kecamatan --&amp;gt;Office&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;??? ???. ???.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wish somone can help. Thank's in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Jun 2011 06:45:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617578#M16552</guid>
      <dc:creator>Cut_EliaRahmi</dc:creator>
      <dc:date>2011-06-05T06:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to query using text box with vba</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617579#M16553</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;First of all can I correct your English. "Wanna" is not an English word, you should be saying "I want to create a query..." not "I wanna create a query...". OK English lesson over.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In your Shapefile example does the facilities field always end with "--&amp;gt;School" or have you put that in as an explanation? If it does then you &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;want to &lt;/SPAN&gt;&lt;SPAN&gt;create a QueryFilter to return a cursor for all rows that end with that text sequence.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can find a simple example of how to create a cursor in the VBA developers Help under the sample section, the page is called "Perform an attribute query".&amp;nbsp; The WhereClause string can be determined easily by doing the query in ArcMap so you get the syntax correct, it should be something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"FACILITIES" LIKE '%--&amp;gt;School'&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jun 2011 10:12:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617579#M16553</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2011-06-07T10:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to query using text box with vba</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617580#M16554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Duncan solution is good.&amp;nbsp; If it were me I'd wanna parse out the data first.&amp;nbsp; Specially if I wanted to use it for a lot of querying and the data wasn't subject to a lot of updates.&amp;nbsp; If you can create a facilityType column and take all the parts after "--&amp;gt;" (field calculator with some vbscript can do that.)&amp;nbsp; Then you could query the facility types with the arcmap attribute selection and wouldn't have to write a stitch of vba code.&amp;nbsp; Indexing the facilities type column would help performance with large datasets.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jun 2011 13:03:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617580#M16554</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-06-07T13:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to query using text box with vba</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617581#M16555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I saw that!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jun 2011 13:09:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617581#M16555</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2011-06-07T13:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to query using text box with vba</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617582#M16556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm sorry, I didn't use formal english:)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"--&amp;gt;School" is an explanation, the data is only consist of 3 fields, i.e FID, SHAPE and FACILITIES.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FID&amp;nbsp; SHAPE&amp;nbsp;&amp;nbsp; FACILITIES&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Point&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SD Negeri Buket Meutuah&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"SD Negeri Buket Meutuah" is a school. Among 1 and other schools don't have the similar word, so do the other facilities. can I use "LIKE '%"?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for sugestion.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2011 08:59:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617582#M16556</guid>
      <dc:creator>Cut_EliaRahmi</dc:creator>
      <dc:date>2011-06-08T08:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to query using text box with vba</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617583#M16557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So you have no consistent naming convention in the facilities field? I think Alexander's advice would help you. Create a new field that codes the type of facility this would simplify your query.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2011 10:01:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617583#M16557</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2011-06-08T10:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to query using text box with vba</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617584#M16558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If there is no way to know what facilities are schools, you can't query data that is not there.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2011 15:03:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617584#M16558</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-06-08T15:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to query using text box with vba</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617585#M16559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for suggestion. I�??ve written code to add new field named �??TYPE�?� and determine the type of facilities using select case. The problem for me is when updating the value of TYPE field. I don�??t know how to set value: if the value in FACILITIES field contents the word SD or SMP or SMA or MAN, so the value in TYPE field is School, etc. Now, that�??s the problem for me before querying, wish someone can help. Below is my code so far:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pMxDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFLayer As IFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFClass As IFeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pMxDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFLayer = pMxDoc.FocusMap.Layer(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFClass = pFLayer.FeatureClass &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pField As IFieldEdit&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pField = New field&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pField.Name = "TYPE"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pField.Type = esriFieldTypeString&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pField.Length = 20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pFClass.AddField pField&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFCursor As IFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFCursor = pFClass.Update(Nothing, True)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFeature As IFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFeature = pFCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim ketFacilities As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Select Case ketFacilities&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ketFacilities = "School"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ketFacilities = "Office"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ketFacilities = "Hospital"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ketFacilities = "Mosque"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case 4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ketFacilities = "City Boundary"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case 5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ketFacilities = "Bridge"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case 6&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ketFacilities = "Bank"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Select&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2011 04:39:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-query-using-text-box-with-vba/m-p/617585#M16559</guid>
      <dc:creator>Cut_EliaRahmi</dc:creator>
      <dc:date>2011-06-13T04:39:27Z</dc:date>
    </item>
  </channel>
</rss>

