Share via


MatchRecord method

Matches the current record to the map.

Applies to

Objects:  Recordset

Syntax

object.MatchRecord([ShowDialogIfAmbiguous], [HWndParent])

Parameters

Part Description
object Required. An expression that returns a Recordset object.
ShowDialogIfAmbiguous Optional Boolean. Opens the Match Records dialog box to enable matching individual records to the map if there is more than one good choice. Default value is False.
HWndParent Optional Long. User's window handle.

Example

Note  This sample assumes that the code is running in a form or class module.

  
    Sub MatchAnUnmatchedPushpin()

  Dim objApp As New MapPoint.Application
  Dim objPin As MapPoint.Pushpin
  Dim objRS As MapPoint.Recordset
  Dim objDS As MapPoint.DataSet

  objApp.Visible = True
  objApp.UserControl = True

  'Open a file that has unmatched records
  Set objDS = objApp.ActiveMap.DataSets.ShowImportWizard()

  'Get all records for the Pushpin data set
  Set objRS = objDS.QueryAllRecords

  'Find an unmatched Pushpin
  Do While Not objRS.EOF
    If objRS.IsMatched = False Then
      Set objPin = objRS.Pushpin
      Exit Do
    Else
      objRS.MoveNext
    End If
  Loop    'end if you get to end of the record set

  'Try to match it if it's not matched
  If Not objRS.IsMatched Then
    objRS.MatchRecord True
  Else
    MsgBox "No unmatched records."
  End If

End Sub