Share via


IsPrimaryKey property

Returns whether the Field object is the primary key field. Valid only for linked sets. Always False for fields in DataSet objects with a HowCreated property of geoDataSetDemographic. Read-only Boolean.

Applies to

Objects:  Field

Syntax

object.IsPrimaryKey

Parameters

Part Description
object Required. An expression that returns a Field object.

Example

  
    Sub FindPrimaryKeyField()
  Dim objApp As New MapPoint.Application
  Dim objDataSet As MapPoint.DataSet
  Dim objFld As MapPoint.Field
  objApp.Visible = True
  objApp.UserControl = True

  'Get a data set to a linked file
  Set objDataSet = objApp.ActiveMap.DataSets.ShowLinkWizard()

  'Check to make sure that it is linked
  If Not objDataSet.IsLinked Then
    MsgBox "Data set is not linked."
    Exit Sub
  End If

  'Find the primary field
  For Each objFld In objDataSet.Fields
    If objFld.IsPrimaryKey Then Exit For
  Next

  MsgBox "The primary key field is: " & objFld.Name