04 Match - AndrewMB2/Logic-Architect-for-Excel-VBA GitHub Wiki

Match method

Matches a field against the same field on another ArrData object. Returns True if successful, otherwise False.

Applies to

TableData ArrData RsetData Xdata XShared

Parameters

Name Type Description
Ad ArrData object The ArrData object to which this object will be matched.
MatchMethod MatchType enumeration One of MatchMaxLE, MatchEqual or MatchMinGE.
MatchField Variant Name or number of field to be matched.
CopyField Variant Name or number of the field to contain the match result.
Default Variant Default value to be used where there is no match.
JoinFields Value, array or ParamArray List of fields (if any) to be matched exactly before the match operation starts.

Match can be used to carry out exact or approximate matches and identify the matching data and which records do not match. It carries out a binary search.

The user specifies which fields must match exactly (the join fields) and then specifies one field for the exact/approximate match (the match field) and the match type

  • MatchMaxLE finds the largest value less than or equal to the value being matched.
  • MatchEqual finds a value equal to the value being matched.
  • MatchMinGE finds the smallest value greater or equal to the value being matched.

It then brings in the value found to a specified field in the calling ArrData object, or a default value if nothing is found. All join fields and the match field must have the same name in both objects. The calling ArrData object must be sorted in order of the join fields and the match field in all cases.