<?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 List access table names, VBA ArcObject in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54154#M1471</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want access the table names in a microsoft access database (.mdb 2003), and populate a list box, allowing the user to select a desired table. Can anyone point me towards some resources that can help or provide some advice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Embedded is my code that connects to the database. The second part of the code is something I am using as I can not get a list of tables, and is what I want to replace. At the bottom of the post is code that works in Microsoft Access and displays each table names in a msgbox, how could I run this code from Arc?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Private Sub DatabaseConnection()

Dim strProperties As String

'Store the properties required for the OLEDB connection
strProperties = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Data\database.mdb"

Dim pPropSet As IPropertySet
Set pPropSet = New PropertySet&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Instantiate a new property set
pPropSet.SetProperty "CONNECTSTRING", strProperties&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Set it properties to the db

Dim pWorkSpaceFact As IWorkspaceFactory

'Set a workspace factory to a new OLEDB factory
Set pWorkSpaceFact = New esriDataSourcesOleDB.OLEDBWorkspaceFactory&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

'Using the code below each table can be accessed by its name
'I want to replace this code
'With a list of all the tables in the access .mdb


Dim pFeatWorkspace As IFeatureWorkspace
Set pFeatWorkspace = pWorkSpaceFact.Open(pPropSet, 0)

Dim pTable As ITable
Set pTable = pFeatWorkspace.OpenTable("NPRI.Address")

Dim strCount As String
MsgBox pTable.RowCount(Nothing)

End Sub&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'***********************&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This code displays table names in microsoft access, this is what I want to do in Arc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim tbl As AccessObject, db As Object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim strMsg As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set db = Application.CurrentData&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For Each tbl In db.AllTables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MsgBox tbl.Name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Next tbl&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Jan 2011 18:52:45 GMT</pubDate>
    <dc:creator>DavidBirkigt</dc:creator>
    <dc:date>2011-01-24T18:52:45Z</dc:date>
    <item>
      <title>List access table names, VBA ArcObject</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54154#M1471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want access the table names in a microsoft access database (.mdb 2003), and populate a list box, allowing the user to select a desired table. Can anyone point me towards some resources that can help or provide some advice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Embedded is my code that connects to the database. The second part of the code is something I am using as I can not get a list of tables, and is what I want to replace. At the bottom of the post is code that works in Microsoft Access and displays each table names in a msgbox, how could I run this code from Arc?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Private Sub DatabaseConnection()

Dim strProperties As String

'Store the properties required for the OLEDB connection
strProperties = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Data\database.mdb"

Dim pPropSet As IPropertySet
Set pPropSet = New PropertySet&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Instantiate a new property set
pPropSet.SetProperty "CONNECTSTRING", strProperties&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Set it properties to the db

Dim pWorkSpaceFact As IWorkspaceFactory

'Set a workspace factory to a new OLEDB factory
Set pWorkSpaceFact = New esriDataSourcesOleDB.OLEDBWorkspaceFactory&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

'Using the code below each table can be accessed by its name
'I want to replace this code
'With a list of all the tables in the access .mdb


Dim pFeatWorkspace As IFeatureWorkspace
Set pFeatWorkspace = pWorkSpaceFact.Open(pPropSet, 0)

Dim pTable As ITable
Set pTable = pFeatWorkspace.OpenTable("NPRI.Address")

Dim strCount As String
MsgBox pTable.RowCount(Nothing)

End Sub&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'***********************&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This code displays table names in microsoft access, this is what I want to do in Arc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim tbl As AccessObject, db As Object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim strMsg As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set db = Application.CurrentData&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For Each tbl In db.AllTables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MsgBox tbl.Name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Next tbl&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jan 2011 18:52:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54154#M1471</guid>
      <dc:creator>DavidBirkigt</dc:creator>
      <dc:date>2011-01-24T18:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: List access table names, VBA ArcObject</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54155#M1472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would think you have to use AccessWorkspaceFactory (esriDataSourcesGDB) instead of OLEDBWorkspaceFactory.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jan 2011 19:26:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54155#M1472</guid>
      <dc:creator>RuchiraWelikala</dc:creator>
      <dc:date>2011-01-24T19:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: List access table names, VBA ArcObject</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54156#M1473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your nudge in the right direction helped a lot. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you know when you would you use the OLEDB connection factory as opposed to the access factory when working with .mdb files? I am new to arcobject programming with .mdb and more information is always nice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;D&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jan 2011 01:34:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54156#M1473</guid>
      <dc:creator>DavidBirkigt</dc:creator>
      <dc:date>2011-01-25T01:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: List access table names, VBA ArcObject</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54157#M1474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's been a while since I've used any of those interfaces but I think AccessWorkspaceFactory is used more for tabular data while oleDBWorkspaceFactory works with GeoDatabases which can store features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps someone else can elaborate on this further (or correct me because I might be wrong).&amp;nbsp; I'm kind of curious now too.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jan 2011 12:32:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54157#M1474</guid>
      <dc:creator>RuchiraWelikala</dc:creator>
      <dc:date>2011-01-25T12:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: List access table names, VBA ArcObject</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54158#M1475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The AccessWorkspaceFactory is used to read personal geodatabases, which are geodatabases stored in an access mdb.&amp;nbsp; The OleDBWorspaceFactory is used to connect to a database using an OLE driver, could be an Access database, could be another type of database.&amp;nbsp; The OLE connection would typically be used on a database that is not a geodatabase.&amp;nbsp; Since OLE connections are not necessarily connecting to Access, they have more parameters to define.&amp;nbsp; Typically you would define a DNS in the dataconnection utility in the Advanced section of the control panel(XP) and reference that file to connect.&amp;nbsp; In my experience I have found OLE connections difficult to work with, slow and flaky so I try to avoid them if I can.&amp;nbsp; The personal geodatabase was a favoured data format prior to the file geodatabase so the AccessWorkspaceFactory was used a lot and is typically quite reliable.&amp;nbsp; It works on non-geodatabase access mdbs as well.&amp;nbsp; Aside from limitations of mdbs themselves, the chief complaint about the AccessWorkspace I have heard about i is that it offers too much latitude in what it will allow you to do.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jan 2011 12:53:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54158#M1475</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-01-25T12:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: List access table names, VBA ArcObject</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54159#M1476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Alex, you have bailed me out yet again on these forums! Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Furthermore, if I were to be dealing with just tabular data (without any spatial attributes), would it be better (more efficient) to use the OLEdB connection interface in .NET (ADO.NET)?.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jan 2011 13:11:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54159#M1476</guid>
      <dc:creator>RuchiraWelikala</dc:creator>
      <dc:date>2011-01-25T13:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: List access table names, VBA ArcObject</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54160#M1477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It is really hard to say which is more efficient without setting both up and doing a real test.&amp;nbsp; It depends on you measure of efficiency, table sizes etc.&amp;nbsp; If you are dealing with small tables, a 100% performance gain could only be milliseconds anyway.&amp;nbsp; Development time and ease of support might be bigger concerns.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You wouldn't do an OLE DB connection to access, you would just use the ODBC driver for Access, ADO.Net supports that.&amp;nbsp; My suspicion would be that ADO.NET would be faster.&amp;nbsp; ESRI Cursors tend to be on the slow side, if you don't need to do any ArcObjects with the data it is an interesting route.&amp;nbsp;&amp;nbsp; Visual Studio has a lot of interesting features when it comes to datatables and data adapters and Linq that work very well with ADO.NET connections.&amp;nbsp; VS has some drag and drop features that make life simple in this regard.&amp;nbsp; If you are trying to populate a .net listbox or datagridview&amp;nbsp; you can bind the control directly to the datatable and edit the data.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jan 2011 14:28:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54160#M1477</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-01-25T14:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: List access table names, VBA ArcObject</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54161#M1478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ruchira, Alexander&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Again thanks to both of you, I appreciate the clarification it is somewhat difficult for me to find this basic information regarding non-spatial .mdb data manipulation and arcObjects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jan 2011 17:50:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/list-access-table-names-vba-arcobject/m-p/54161#M1478</guid>
      <dc:creator>DavidBirkigt</dc:creator>
      <dc:date>2011-01-25T17:50:07Z</dc:date>
    </item>
  </channel>
</rss>

