The latest updates are not displayed in layers and tables based on a query after a refresh in ArcMap


When performing edits on the underlying data, the changes are not reflected in map layers and tables that are based on a query. This is the case even after clicking refresh view or reload cache in the table window.


If a primary key is not supplied when the layer or table is created, a copy of the data is made and an ObjectID column is added. The copy version is what is used when the data is read. If there are changes in the underlying database, the copy is not updated, and these changes are not seen.

Solution or Workaround

In ArcGIS 10.0, this solution requires a separate VBA license.

The table that the feature layer or standalone table object references must be closed and reopened.

The code below shows how to do this with feature layers. For standalone tables, all references pointing to the table need to be removed and re-added to ArcMap.

Public Sub Refresh_Copy()

Dim pMXDoc As IMxDocument
Dim pDTable As IDisplayTable
Dim pDataSet As IDataset
Dim pQName2 As IQueryName2
Dim pName As IName
Dim pStTab As IStandaloneTable
Dim pFLayer As IFeatureLayer
Dim pTable As ITable

Set pMXDoc = ThisDocument
Set pDTable = pMXDoc.SelectedItem
If Not TypeOf pDTable Is IFeatureLayer Then Exit Sub
Set pDataSet = pDTable.DisplayTable

If TypeOf pDataSet.FullName Is IQueryName2 Then
Set pQName2 = pDataSet.FullName
Set pName = pQName2
Set pFLayer = pDTable
Set pFLayer.FeatureClass = Nothing
Set pDTable = Nothing
Set pDataSet = Nothing
Set pTable = pName.Open
Set pFLayer.FeatureClass = pTable
End If

End Sub

Article ID:000005735

  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic