ERROR
When adding a new record to an address table that has a related geocoded feature class, this error occurs: “Could not insert new record."
If the address table is dynamically related to a geocoded feature class, the GeocodedFeatureClassExtension feature class extension on the geocoded feature class attempts to geocode the address contained in the record that was added to the address table. If this error occurs, the reference data for the geocoding service that was used to create the geocoded feature class is unavailable.
Code:
Public Sub DisableAutomaticGeocoding(pFeatureClass As IFeatureClass)
Const GUID_NAME_GEOCODEDFEATURECLASSEXTENSION = _
"esricore.GeocodedFeatureClassExtension"
Dim pClassSchemaEdit As IClassSchemaEdit
Dim pPropertySet As IPropertySet
Dim pSchemaLock As ISchemaLock
Dim pUID As New UID
' +++ Get an exclusive lock on the FeatureClass
Set pSchemaLock = pFeatureClass
pSchemaLock.ChangeSchemaLock esriExclusiveSchemaLock
' +++ Alter the FeatureClassExtension on the geocoded FeatureClass
pUID.Value = GUID_NAME_GEOCODEDFEATURECLASSEXTENSION
Set pPropertySet = New PropertySet
With pPropertySet
.SetProperty "OriginalAddressFieldNames", "Address"
' +++ The UpdateOnEdit property indicates if Features in the
' +++ FeatureClass are updated if the corresponding Rows in the
' +++ Table are edited
.SetProperty "UpdateOnEdit", True
' +++ The UnmatchOnly property whether the
' +++ GeocodedFeatureClassExtension should attempt to geocode
' +++ inserted or edited Features or to add them to the
' +++ FeatureClass with a status of Unmatched
.SetProperty "UnmatchOnly", True
End With
Set pClassSchemaEdit = pSchemaLock
pClassSchemaEdit.AlterClassExtensionCLSID pUID, pPropertySet
' +++ Reset the schema lock on the FeatureClass
pSchemaLock.ChangeSchemaLock esriSharedSchemaLock
End Sub
Article ID:000003785
Get help from ArcGIS experts
Download the Esri Support App