<?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: Getting an Access 2007 table (.accdb extension) in ArcMap programmatically in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326224#M8506</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://resources.arcgis.com/content/kbase?fa=articleShow&amp;amp;d=32976"&gt;http://resources.arcgis.com/content/kbase?fa=articleShow&amp;amp;d=32976&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;should answer your question.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Feb 2011 14:42:19 GMT</pubDate>
    <dc:creator>NathanOgden</dc:creator>
    <dc:date>2011-02-10T14:42:19Z</dc:date>
    <item>
      <title>Getting an Access 2007 table (.accdb extension) in ArcMap programmatically</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326221#M8503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have recently found a script from ArcScripts on how to get an Access table in ArcGIS programmatically and it works well.&amp;nbsp; But this is for Access 2003 (.mdb extension) and earlier.&amp;nbsp; The code is posted below, and I want to know how to modify it for using Access 2007 (.accdb extension) and later databases.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Attribute VB_Name = "Access_connect"
Sub Open_Access_Connect()
&amp;nbsp; 'V. Guissard Jan. 2007

&amp;nbsp; On Error GoTo EH

&amp;nbsp; Dim data_source As String
&amp;nbsp; Dim pTable As ITable
&amp;nbsp; Dim TableName As String
&amp;nbsp; 
&amp;nbsp; Dim pFeatWorkspace As IFeatureWorkspace
&amp;nbsp; Dim pMap As IMap
&amp;nbsp; Dim mxDoc As IMxDocument
&amp;nbsp; Dim pPropset As IPropertySet
&amp;nbsp; Dim pStTab As IStandaloneTable
&amp;nbsp; Dim pStTabColl As IStandaloneTableCollection
&amp;nbsp; Dim pWorkspace As IWorkspace
&amp;nbsp; Dim pWorkspaceFact As IWorkspaceFactory
&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp; Set pPropset = New PropertySet
&amp;nbsp; ' Get MDB file name
&amp;nbsp; data_source = GetFolder("mdb")
&amp;nbsp; ' Connect to the MDB database
&amp;nbsp; pPropset.SetProperty "CONNECTSTRING", "Provider=Microsoft.Jet.OLEDB.4.0;" _
&amp;nbsp; &amp;amp; "Data source=" &amp;amp; data_source &amp;amp; ";User ID=Admin;Password="
 
&amp;nbsp; Set pWorkspaceFact = New OLEDBWorkspaceFactory
&amp;nbsp; Set pWorkspace = pWorkspaceFact.Open(pPropset, 0)
&amp;nbsp; Set pFeatWorkspace = pWorkspace
&amp;nbsp; 
&amp;nbsp; ' Get table name
&amp;nbsp; TableName = SelectDataSet(pFeatWorkspace, "Table")
&amp;nbsp; ' Open the table
&amp;nbsp; Set pTable = pFeatWorkspace.OpenTable(TableName)
&amp;nbsp; 'Create Table collection and add the table to ArcMap
&amp;nbsp; Set mxDoc = ThisDocument
&amp;nbsp; Set pMap = mxDoc.FocusMap
&amp;nbsp; Set pStTab = New StandaloneTable
&amp;nbsp; Set pStTab.Table = pTable
&amp;nbsp; Set pStTabColl = pMap
&amp;nbsp; pStTabColl.AddStandaloneTable pStTab
&amp;nbsp; 
&amp;nbsp; ' Update ArcMap Source TOC
&amp;nbsp; mxDoc.UpdateContents
&amp;nbsp;&amp;nbsp; 
&amp;nbsp; Exit Sub
&amp;nbsp; 
EH:
&amp;nbsp; 
&amp;nbsp; MsgBox "Access connect: " &amp;amp; Err.Number &amp;amp; " " &amp;amp; Err.Description

End Sub

Public Function GetFolder(Optional aFilter As String) As String
&amp;nbsp; ' Open a GUI to let the user select a Folder path name (by default) or :
&amp;nbsp; ' Set aFilter = "shp" to get a shapefile name
&amp;nbsp; ' Set aFilter = "mdb" to get an MS Access file name
&amp;nbsp; ' Return the Folder Path or phath &amp;amp; file name As String
&amp;nbsp; ' V. Guissard Jan. 2007
&amp;nbsp; 
&amp;nbsp; Dim pGxDialog As IGxDialog
&amp;nbsp; Dim pFilterCol As IGxObjectFilterCollection
&amp;nbsp; Dim pCurrentFilter As IGxObjectFilter
&amp;nbsp; Dim pEnumGx As IEnumGxObject
&amp;nbsp; 
&amp;nbsp; Select Case aFilter
&amp;nbsp;&amp;nbsp;&amp;nbsp; Case "shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pCurrentFilter = New GxFilterShapefiles
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aTitle = "Select Shapefile"
&amp;nbsp;&amp;nbsp;&amp;nbsp; Case "mdb"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pCurrentFilter = New GxFilterContainers
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aTitle = "Select MS Access database"
&amp;nbsp;&amp;nbsp;&amp;nbsp; Case Else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pCurrentFilter = New GxFilterBasicTypes
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aTitle = "Select Folder"
&amp;nbsp; End Select
&amp;nbsp; 
&amp;nbsp; Set pGxDialog = New GxDialog
&amp;nbsp; Set pFilterCol = pGxDialog
&amp;nbsp; With pFilterCol
&amp;nbsp;&amp;nbsp;&amp;nbsp; .AddFilter pCurrentFilter, True
&amp;nbsp; End With
&amp;nbsp; With pGxDialog
&amp;nbsp;&amp;nbsp;&amp;nbsp; .Title = aTitle
&amp;nbsp;&amp;nbsp;&amp;nbsp; .ButtonCaption = "Select"
&amp;nbsp; End With
&amp;nbsp; 
&amp;nbsp; If Not pGxDialog.DoModalOpen(0, pEnumGx) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; Smp = MsgBox("No selection : Exit", vbCritical)
&amp;nbsp;&amp;nbsp;&amp;nbsp; End
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Exit Function 'Exit if user press Cancel
&amp;nbsp; End If
&amp;nbsp; GetFolder = pEnumGx.Next.FullName
&amp;nbsp; 
End Function

Public Function SelectDataSet(pWorkspace As IWorkspace, Optional theDataType As String) As String
&amp;nbsp; ' Open a GUI to let the user select a DataSet into a Workspace
&amp;nbsp; ' (Table or Request into an MS Access Database or a Geodatabase File)
&amp;nbsp; ' Set pWorkspace to the DataSet IWorkspace
&amp;nbsp; ' Set theDataType = "Table" to select a Table name of the DataSet
&amp;nbsp; ' Return the selected Table or Request Table name As String
&amp;nbsp; ' V. Guissard Jan. 2007
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; Dim aDataset As Boolean
&amp;nbsp; Dim boolOK As Boolean
&amp;nbsp; Dim DataSetList As New Collection
&amp;nbsp; Dim datasetType As Integer
&amp;nbsp; Dim n As Integer
&amp;nbsp; 
&amp;nbsp; Dim pDataSetName As IDatasetName
&amp;nbsp; Dim pListDlg As IListDialog
&amp;nbsp; Dim pEnumDatasetName As IEnumDatasetName
&amp;nbsp; 
&amp;nbsp; ' Set the Dataset Type
&amp;nbsp; Select Case theDataType
&amp;nbsp;&amp;nbsp;&amp;nbsp; Case "Table"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datasetType = 10
&amp;nbsp;&amp;nbsp;&amp;nbsp; Case Else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Answ = MsgBox("Need a Dataset Type : Exit", vbCritical, "SelectDataset")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End
&amp;nbsp; End Select
&amp;nbsp; 
&amp;nbsp; ' Get the Dataset Names included in the workspace
&amp;nbsp; Set pEnumDatasetName = pWorkspace.DatasetNames(datasetType)
&amp;nbsp; 
&amp;nbsp; ' Create the Dataset Names List Dialog
&amp;nbsp; aDataset = False
&amp;nbsp; Set pListDlg = New ListDialog
&amp;nbsp; pEnumDatasetName.Reset
&amp;nbsp; Set pDataSetName = pEnumDatasetName.Next
&amp;nbsp; Do While Not pDataSetName Is Nothing
&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; pListDlg.AddString pDataSetName.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataSetList.Add (pDataSetName.name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pDataSetName = pEnumDatasetName.Next
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aDataset = True
&amp;nbsp; Loop
&amp;nbsp; 
&amp;nbsp; ' Open a GUI for the user to select a dataset
&amp;nbsp; If aDataset Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; boolOK = pListDlg.DoModal("Select a " &amp;amp; theDataType, 0, Application.hwnd)
&amp;nbsp;&amp;nbsp;&amp;nbsp; n = pListDlg.choice
&amp;nbsp;&amp;nbsp;&amp;nbsp; If (n &amp;lt;&amp;gt; -1) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelectDataSet = DataSetList(n + 1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sup = MsgBox("No DataSet selected : EXIT", vbCritical, "SelectDataset")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp; End If
End Function&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the link to the ArcScript: &lt;/SPAN&gt;&lt;A href="http://arcscripts.esri.com/Data/AS14882.bas" rel="nofollow noopener noreferrer" target="_blank"&gt;http://arcscripts.esri.com/Data/AS14882.bas&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS I know this code is written in VBA and I don't know if a modified version is in VB.NET or whatever else language.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Adrian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:27:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326221#M8503</guid>
      <dc:creator>AdrianWelsh</dc:creator>
      <dc:date>2021-12-11T15:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an Access 2007 table (.accdb extension) in ArcMap programmatically</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326222#M8504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Our office recently upgraded to Office 2010 and we have the same problem, sort of. I was wondering if the accdb file extension is supported in the latest version of ArcView desktop. We are running 9.3.1 and the file extension won't allow the file to be viewed. A temporary work around is to save &amp;amp; publish the DB file in 2003 format, but that risks losing functionality. Using the connect to instructions ESRI has posted is too cumbersome for us and I'm told everybody using the file would have to do the same thing on their machine. Some don't have Office 2010 yet and still need to view the files.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 21:12:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326222#M8504</guid>
      <dc:creator>StevenHambacher</dc:creator>
      <dc:date>2011-02-09T21:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an Access 2007 table (.accdb extension) in ArcMap programmatically</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326223#M8505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do you even need to get ArcGIS involved? What happens if you just change the OLEDB driver to the 2007-compatible one? Change this line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pPropset.SetProperty "CONNECTSTRING", "Provider=Microsoft.Jet.OLEDB.4.0;" &amp;amp; "Data source=" &amp;amp; data_source &amp;amp; ";User ID=Admin;Password="&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pPropset.SetProperty "CONNECTSTRING", "Provider=Microsoft.ACE.OLEDB.12.0;" &amp;amp; "Data source=" &amp;amp; data_source &amp;amp; ";User ID=Admin;Password="&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and (in theory) up goes the donkey.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2011 00:50:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326223#M8505</guid>
      <dc:creator>PaulDowling1</dc:creator>
      <dc:date>2011-02-10T00:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an Access 2007 table (.accdb extension) in ArcMap programmatically</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326224#M8506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://resources.arcgis.com/content/kbase?fa=articleShow&amp;amp;d=32976"&gt;http://resources.arcgis.com/content/kbase?fa=articleShow&amp;amp;d=32976&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;should answer your question.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2011 14:42:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326224#M8506</guid>
      <dc:creator>NathanOgden</dc:creator>
      <dc:date>2011-02-10T14:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Getting an Access 2007 table (.accdb extension) in ArcMap programmatically</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326225#M8507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you, I did see something similiar, but still had some problems. I had two fields that were calculated from a query that caused errors in several places, including not showing up in the exported shape file. When I added two new fields in the shape file and re-calculated them, each calculation crashed ArcView and sent a report to ESRI. Calculations worked and data in fields are correct, but I can see this being really bad for many people/situations. Also discovered you can't publish &amp;amp; save to an earlier Access format, as that won't work any better.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2011 17:51:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/getting-an-access-2007-table-accdb-extension-in/m-p/326225#M8507</guid>
      <dc:creator>StevenHambacher</dc:creator>
      <dc:date>2011-02-10T17:51:43Z</dc:date>
    </item>
  </channel>
</rss>

