|
Try something like:
Function HighlightClosest(oDataset As MapPoint.DataSet, oCentre As MapPoint.Location, rlngCount As Long)
Dim rs As MapPoint.Recordset
Dim lngRecordCount As Long
Dim Radius As Double
Const INCREMENT = 0.1
Const MAX_RADIUS = 1
On Error GoTo HC_Error
Radius = 0
Do
Radius = Radius + INCREMENT
Set rs = oDataset.QueryCircle(oCentre, Radius)
lngRecordCount = 0
rs.MoveFirst
If Not rs.EOF Then
Do
rs.Pushpin.Highlight = True
lngRecordCount = lngRecordCount + 1
rs.MoveNext
Loop While Not rs.EOF
End If
Set rs = Nothing
Loop While Radius < MAX_RADIUS And lngRecordCount < rlngCount
HC_Exit:
Exit Function
HC_Error:
Debug.Print Err.Description
Resume HC_Exit
End Function
You will also need something to whizz round and remove the highlights when you no longer want them. You will also need to adjust the MAX_RADIUS and INCREMENT to suit your data
BTW wouldn't recommend using MouseMove event, especially if you are using large datasets.
HTH
M. |