Share via


CallMatchMethod method

Returns the result of matching the specified record to the map. If there is an exact match, MapPoint matches the record and the user's method (MethodName) is not called. If MapPoint finds more than one possible match, the MethodName method is called to resolve the ambiguity. If the record is matched by either MapPoint or the MethodName method, returns True. If MapPoint or the MethodName method is unable to find a match, returns False. Read-only Boolean.

Applies to

Objects: Recordset

Syntax

object.CallMatchMethod(MethodName, MethodObject)

Parameters

Part

Description

object

Required. An expression that returns a Recordset object.

MethodName

Required String. Name of the user's method that is called to match records to the map when MapPoint finds more than one possible match.

MethodObject

Required Object. The user's object to which the MethodName method is applied.

Remarks

  • The user's method must be callable from a COM object (on a form or in a class) and use the syntax described in MethodName syntax. The result of this method is a value that is a 1-based index into the FindResults collection. If the method returns -1, MapPoint will not match the record.

Example

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

Sub MatchAllAmbiguousRecords()
Dim objApp As New MapPoint.Application
Dim objDataSet As MapPoint.DataSet
Dim objRecords As MapPoint.Recordset

'Set up application and objects to use
objApp.Visible = True
objApp.UserControl = True

'Let user create data map
Set objDataSet = _
objApp.ActiveMap.DataSets.ShowImportWizard

'Match all ambiguous records to first choice
Set objRecords = objDataSet.QueryAllRecords
objRecords.MoveFirst
Do While Not objRecords.EOF
If Not objRecords.IsMatched Then
objRecords.CallMatchMethod "AutoMatchToFirstPick", Me
End If
objRecords.MoveNext
Loop
End Sub

Public Function AutoMatchToFirstPick( _
Name As String, _
Results As FindResults) _
As Long
AutoMatchToFirstPick = 1
End Function