shaunrconway

Exporting attribute table to dbf - Control fields

Discussion created by shaunrconway on Dec 14, 2010
Latest reply on Dec 14, 2010 by shaunrconway
Hello,

Thanks in advance for any help. I'm working on exporting an attribute table (to dbf). The code works great - now I just need to figure out how to exclude certain fields. The source of the code mentioned it would act similar to the export function form the options menu. That doesn't appear to be true. I've turned off all of the fields I wish to exclude. This didn't seem to work.

Any advice would be great!

Thanks,
Shaun

[INDENT]Public Function Export_Table(pExportSelection As IFeatureSelection)
    Dim pExportLayer As IFeatureLayer
    Dim pTableName As IDatasetName
    Dim pTable As ITable
    Dim pDispTab As IDisplayTable
    Dim pExpOp As IExportOperation
    Dim pDataSet As IDataset
    Dim pDataSetName As IDatasetName
    Dim pWkSpFactory As IWorkspaceFactory
    Dim pWkSp As IWorkspace
    Dim pWkSpDataSet As IDataset
    Dim pWkSpName As IWorkspaceName
    Dim pOutDataSetName As IDatasetName
   
   
    Set pWkSpFactory = New ShapefileWorkspaceFactory
    Set pWkSp = pWkSpFactory.OpenFromFile(frmGetDir.txtDirName, 0)
    Set pWkSpDataSet = pWkSp
    Set pWkSpName = pWkSpDataSet.FullName
    Set pOutDataSetName = New tablename
    pOutDataSetName.Name = "AdjoiningOwners"
    Set pOutDataSetName.WorkspaceName = pWkSpName
   
    Dim pQFlt As IQueryFilter
    Set pQFlt = New QueryFilter
    Dim sWhereClse As String
    sWhereClse = "Parcel_ID <> " & pTarget.Value(pTarget.Fields.FindField("Parcel_ID"))
    pQFlt.WhereClause = sWhereClse
   
    Set pExportLayer = pExportSelection
    Set pDispTab = pExportLayer
    Set pTable = pDispTab.DisplayTable
   
    Set pDataSet = pTable
    Set pDataSetName = pDataSet.FullName
   
    Set pExpOp = New ExportOperation
   
    Set pTableName = New tablename
   
    pTableName.Name = "C:\Documents and Settings\conwasc\Desktop\MATest\Planning"
   
    pExpOp.ExportTable pDataSetName, pQFlt, pDispTab.DisplaySelectionSet, pOutDataSetName, Application.hWnd

End Function
  [/INDENT]

Outcomes