The .ldb file remains when you delete a Geometric Network

Last Published: April 25, 2020


When you use VBA and attempt to delete a Geometric Network in a Personal Geodatabase, the .ldb file remains on disk.


ArcMap has a lock on the schema.

Solution or Workaround

Use ISchemaLock::ChangeSchemaLock to release the lock.

Dim pWorkspace As IWorkspace
Dim pWorkspaceFactory As IWorkspaceFactory
Dim pFeatureWorkspace As IFeatureWorkspace
Dim pDataset As IDataset
Dim pGeomNetCol As INetworkCollection
Dim pGeomNet As IGeometricNetwork
Dim pFeatureDataset As IFeatureDataset

Set pWorkspaceFactory = New AccessWorkspaceFactory

' Montgomery.mdb installs with the ArcGIS sample data
Set pWorkspace = pWorkspaceFactory.OpenFromFile("C:\Temp\Montgomery.mdb", 0)

Set pFeatureWorkspace = pWorkspace
Set pFeatureDataset = pFeatureWorkspace.OpenFeatureDataset("water")
Set pGeomNetCol = pFeatureDataset

If pGeomNetCol.GeometricNetworkCount > 0 Then

Set pGeomNet = pGeomNetCol.GeometricNetworkByName("Water_Net")
Set pDataset = pGeomNet

' **********
' ISchemaLock::ChangeSchemaLock releases the lock
Dim pSchemaLock As ISchemaLock
Set pSchemaLock = pDataset
pSchemaLock.ChangeSchemaLock (esriSharedSchemaLock)
' **********

Set pGeomNet = Nothing
Set pDataset = Nothing

End If

Set pWorkspace = Nothing
Set pWorkspaceFactory = Nothing
Set pGeomNetCol = Nothing
Set pFeatureWorkspace = Nothing
Set pFeatureDataset = Nothing

Article ID:000004715

  • ArcMap 8 x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options