<?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: Open Attribute Table of a Standalone Table in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199279#M5179</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Duncan!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This works fine. Thank you so much. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; My problem is that in this sample you have to select a layer in the TOC and not in a combobox. Unfortunately, I don't know how to find out if the layer behind the selected name is a feature layer, a dBASE table or an excel table. Do you have any idea?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Jul 2010 05:42:53 GMT</pubDate>
    <dc:creator>CK</dc:creator>
    <dc:date>2010-07-02T05:42:53Z</dc:date>
    <item>
      <title>Open Attribute Table of a Standalone Table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199277#M5177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a ComboBox with all names of the Feature Layers that are listed in the Table of Contents. Furthermore, the ComboBox includes some Standalone Tables. What I want is to open the attribute table of the layer or standalone table which has been selected in the ComboBox. I know the code for feature layers but not for standalone tables. Can anybody help please?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code to open the attribute table of a feature layer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMxDocument&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pLayer&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; As ILayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pUID&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;&amp;nbsp;&amp;nbsp; As New UID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pCommandItem&amp;nbsp;&amp;nbsp;&amp;nbsp; As ICommandItem&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim strLayername As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strLayername = ComboBox.value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMxDocument = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pLayer = general.FindLayer(strLayername)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pMxDocument.ContextItem = pLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pUID.value = "esriArcMapUI.FeatureLayerContextMenuItems"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pUID.SubType = 4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pCommandItem = Application.Document.CommandBars.Find(pUID)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pCommandItem.Execute&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jun 2010 17:09:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199277#M5177</guid>
      <dc:creator>CK</dc:creator>
      <dc:date>2010-06-29T17:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Open Attribute Table of a Standalone Table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199278#M5178</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;Sample code can be found in the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Developers Help&lt;/SPAN&gt;&lt;SPAN&gt;. It is under VBA Samples&amp;gt;Tables&amp;gt;Open a Table window.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jun 2010 22:20:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199278#M5178</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2010-06-29T22:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Open Attribute Table of a Standalone Table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199279#M5179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Duncan!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This works fine. Thank you so much. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; My problem is that in this sample you have to select a layer in the TOC and not in a combobox. Unfortunately, I don't know how to find out if the layer behind the selected name is a feature layer, a dBASE table or an excel table. Do you have any idea?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jul 2010 05:42:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199279#M5179</guid>
      <dc:creator>CK</dc:creator>
      <dc:date>2010-07-02T05:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Open Attribute Table of a Standalone Table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199280#M5180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How did you get the names of the layers and tables into the combobox?&amp;nbsp; Probably by some simple looping through IMap:Layers &amp;amp; IStandaloneTableCollection.&amp;nbsp; You can do the same to find the selected item in the combobox.&amp;nbsp; Code below might not be 100% correct as I'm just typing &amp;amp; haven't tried it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for intX = 0 to pMap.layercount -1
&amp;nbsp; if pmap.layer(intx).name = combobox1.value then
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'call modified dev sample
&amp;nbsp;&amp;nbsp;&amp;nbsp; OpenWindow(pmap.layer(intx))
&amp;nbsp;&amp;nbsp;&amp;nbsp; exit sub 
 end if
next
'if not a layer try the tables
dim pSTColl as iStandaloneTableCollection
set pstcoll = pmap
for intx = 0 to pstcoll.StandaloneTableCount -1
&amp;nbsp; if pstcoll.standaloneTable(intx).name = combobox1.value then
&amp;nbsp;&amp;nbsp;&amp;nbsp; openWindow(pstcoll.standaloneTable(intx))
&amp;nbsp;&amp;nbsp;&amp;nbsp; exit sub
 endif

next

'if could not find either a layer or table...
msgbox("couldn't find it")
exit sub

'modified vba sample from Dev Help
Private Sub OpenWindow(pUnknown as IUnknown)
&amp;nbsp; Dim pMxDoc As IMxDocument

&amp;nbsp; Dim pLayer As ILayer
&amp;nbsp; Dim pStandaloneTable As IStandaloneTable
&amp;nbsp; Dim pTableWindow2 As ITableWindow2
&amp;nbsp; Dim pExistingTableWindow As ITableWindow
&amp;nbsp; Dim SetProperties As Boolean
&amp;nbsp; 
&amp;nbsp; 'Get the selected item from the current contents view
&amp;nbsp; Set pMxDoc = ThisDocument
&amp;nbsp; Set pTableWindow2 = New TableWindow

&amp;nbsp; 
&amp;nbsp; ' Determine the selected item's type
&amp;nbsp; ' Exit sub if item is not a feature layer or standalone table
&amp;nbsp; If TypeOf pUnknown Is IFeatureLayer Then 'A FeatureLayer
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pLayer = pUnknown
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pExistingTableWindow = _
&amp;nbsp;&amp;nbsp;&amp;nbsp; pTableWindow2.FindViaLayer(pLayer)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Check if a table already exists; if not create one
&amp;nbsp;&amp;nbsp;&amp;nbsp; If pExistingTableWindow Is Nothing Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pTableWindow2.Layer = pLayer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetProperties = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp; ElseIf TypeOf pUnknown Is IStandaloneTable Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' A standalone table
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pStandaloneTable = pUnknown
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pExistingTableWindow = _
&amp;nbsp;&amp;nbsp;&amp;nbsp; pTableWindow2.FindViaStandaloneTable(pStandaloneTable)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Check if a table already exists; if not, create one
&amp;nbsp;&amp;nbsp;&amp;nbsp; If pExistingTableWindow Is Nothing Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pTableWindow2.StandaloneTable = pStandaloneTable
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetProperties = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp; End If
&amp;nbsp; 
&amp;nbsp; If SetProperties Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; pTableWindow2.TableSelectionAction = esriSelectFeatures
&amp;nbsp;&amp;nbsp;&amp;nbsp; pTableWindow2.ShowSelected = False
&amp;nbsp;&amp;nbsp;&amp;nbsp; pTableWindow2.ShowAliasNamesInColumnHeadings = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pTableWindow2.Application = Application
&amp;nbsp; Else
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pTableWindow2 = pExistingTableWindow
&amp;nbsp; End If
&amp;nbsp; 
&amp;nbsp; ' Ensure Table Is Visible
&amp;nbsp; If Not pTableWindow2.IsVisible Then pTableWindow2.Show True
&amp;nbsp; 
End Sub



&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hope this helps, TG&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:56:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199280#M5180</guid>
      <dc:creator>TerryGiles</dc:creator>
      <dc:date>2021-12-11T09:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Open Attribute Table of a Standalone Table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199281#M5181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you so much! This is exactly what I was searching for. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jul 2010 19:22:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/open-attribute-table-of-a-standalone-table/m-p/199281#M5181</guid>
      <dc:creator>CK</dc:creator>
      <dc:date>2010-07-04T19:22:51Z</dc:date>
    </item>
  </channel>
</rss>

