Find Record in Dataset from selected Pushpin

neomoon
09-11-2003, 07:13 AM
Hi,

I've imported a dataset from a textfile and show it as pushpins in the map. So far everything works just fine. From the textfile I also imported a field wich contains the GUID for this record. I set the type for this field to geoFieldData.
Now: If the user selects a pushpin, I get the event and the pushpinobject. This also works just fine. What I need is to find the matching record in the dataset, so that I would get the GUID which was imported with this pushpin.
Could anyone please help!?

neomoon
09-11-2003, 07:49 AM
:D

Found the answer my self.
From the pushpinobject you use the parent-property to get the dataset. On this dataset you use the QueryAllRecords-methode to get a mappoint recordset. On this recordset you use the MoveToPushpin-methode and you'll be on the record to this pushpin and access all fields that have been imported.

Private Sub mMap_SelectionChange(ByVal pNewSelection As Object, ByVal pOldSelection As Object)
If TypeName(pNewSelection) = "Pushpin" Then
Dim pP As Pushpin
Set pP = pNewSelection
Dim pDS As DataSet
Set pDS = pP.Parent
Dim pRS As MapPointCtl.Recordset
Set pRS = pDS.QueryAllRecords
pRS.MoveToPushpin pP
If Not pRS.EOF Then
Debug.Print "Found: " + pRS.Fields(6).Value
RaiseEvent FilterSelection("ID = '" + pRS.Fields(6).Value + "'")
End If
End If
End Sub

 
Web mp2kmag.com
mapforums.com