Cannot use an existing ArcSDE feature class' fields collection when creating a scratch feature class in personal geodatabase.
Last Published: August 25, 2014No Product Found
Bug ID Number
NIM000180
Submitted
October 28, 2005
Last Modified
June 5, 2024
Applies to
No Product Found
Version found
9.1
Status
Will Not Be Addressed
The development team has considered the issue or request and concluded it will not be addressed. The issue's Additional Information section may contain further explanation.
Additional Information
No Public Explanation
Workaround
Copy the fields collection into a new fields collection. See the code below. Alternatively, create the fields collection from scratch. This is better as it will account for fully qualified field names like sde.username.fieldname.Private Sub MakeScratchCopyb1() Dim pMxDoc As IMxDocument Dim pMap As IMap Dim pFlayer As IFeatureLayer Dim pFC As IFeatureClass ' creates a scratch featureclass Set pMxDoc = Application.Document Set pMap = pMxDoc.FocusMap Set pMxDoc = Application.Document Dim pInFC As IFeatureClass Set pFlayer = pMxDoc.SelectedLayer Set pInFC = pFlayer.FeatureClass 'set up the scratch work area Dim pSWSF As IScratchWorkspaceFactory Set pSWSF = New ScratchWorkspaceFactory Dim pFWS As IFeatureWorkspace Set pFWS = pSWSF.DefaultScratchWorkspace Dim pFields As IFields Dim i As Integer Set pFields = New Fields Dim pField As IField Dim pFieldsEdit As IFieldsEdit Set pFieldsEdit = pFields For i = 0 To pInFC.Fields.FieldCount - 1 Set pField = pInFC.Fields.Field(i) pFieldsEdit.AddField pField Next i 'create our new scratch featureclass based on our input featureclass Dim pScratchFC As IFeatureClass Set pScratchFC = pFWS.CreateFeatureClass("QuarterQuarter", pFields, Nothing, Nothing, esriFTSimple, "SHAPE", "") End Sub