English

Error: Could not insert new record

Error Message

When adding a new record to an address table that has a related geocoded feature class, this error occurs:

“Could not insert new record."

Cause

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.

Solution or Workaround

You can modify the GeocodedFeatureClassExtension object so it does not attempt to geocode new records that you add to the address table. Use the following steps to modify the GeocodedFeatureClassExtension on the geocoded feature class:

  1. Paste the following VBA procedure into the VBA editor:

    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

  2. Write a procedure that calls the DisableAutomaticGeocoding() function. This function takes as an argument a reference to the geocoded feature class that is related to your address table.
  3. Run your procedure from the VBA editor to disable automatic geocoding of the address table.