I created test program with MapPoint 2004. My program is using txt file to
create DataSet, after that reading Access DB with X and Y and update this
txt file, next step is updating Location of pushpin on Map with UpdateLink
method of object DataSet. After around 990 records the program has run-time error -2147190772 "Method 'UpdateLink' of object 'DataSet' failed". Can you tell me please, what I am doing wrong?


Private Sub cmdImportMsg_Click()
Dim adoMessage As ADODB.Recordset
Dim db As ADODB.Connection
Dim PW As String
Dim numMessage As Long
Const adoOpenStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source="
Set db = New ADODB.Connection
Set adoMessage = New ADODB.Recordset
MappointControl1.ActiveMap.Altitude = 100
db.Open adoOpenStr & App.Path & "\msglog.mdb"
adoMessage.Open "Select * from Logs", db, adOpenStatic, adLockOptimistic
If adoMessage.RecordCount <> 0 Then
Do While Not adoMessage.EOF
If adoMessage.Fields("Longitude") <> 0 And
adoMessage.Fields("Latitude") <> 0 Then
Call KeepInTextFile(1, 1, adoMessage.Fields("Longitude"),
MappointControl1.ActiveMap.DataSets("Filtered").Up dateLink
numMessage = numMessage + 1
End If
txtMsg.Text = numMessage
End If
Set adoMessage = Nothing
Set db = Nothing
End Sub

Private Sub Form_Load()
'// Creates a new map. You must specify either the map region
'// (geoMapEurope or geoMapNorthAmerica) to open the default template
'// that region or a file name of a template to use for the new map.

Me.MappointControl1.NewMap geoMapNorthAmerica
End Sub
Private Sub Form_Unload(Cancel As Integer)
'// Any changes,including zooming and panning, made to the map causes
'// this the ActiveMap.Saved to be set to false and the end user will be
'// prompted by the MapPoint engine to see if they want to save the
'// map. Setting it to true will eliminate this prompt but the map file
'// will also not contain any of the changes made.

MappointControl1.ActiveMap.Saved = True

End Sub
Public Sub KeepInTextFile(TmpInt As Integer, nameTab As String, x1 As
Double, y1 As Double)
Dim x As Integer
Dim strLine() As String
Dim n As Integer

ReDim Preserve strLine(2)
strLine(0) = "UnitID, Longitude, Latitude"
strLine(1) = nameTab & "," & y1 & "," & x1
Open App.Path & "\" & TmpInt & "Logs.txt" For Output As #1
For n = 0 To UBound(strLine) - 1
Print #1, strLine(n)
Close #1
End Sub
Public Sub ShowAll()
Dim objRecordset As MapPointCtl.Recordset
Dim objDataSets As MapPointCtl.DataSets
Dim objDataSet As MapPointCtl.DataSet
Dim FilePathAndName As String
Dim arArray As Variant
Dim myExampleArray(1 To 3, 1 To 2) As Variant

'// Get the DataSets collection
Set objDataSets = MappointControl1.ActiveMap.DataSets
If DSExist(CStr("Filtered")) Then
End If

'//Field is specified by name
myExampleArray(1, 1) = "UnitId"
'//tells MapPoint to use this field as the Name field
myExampleArray(1, 2) = geoFieldName

myExampleArray(2, 1) = "LastLatitude"
'//tells MapPoint to use this field as the latitude field
myExampleArray(2, 2) = geoFieldLatitude

'//Field again specifed by name
myExampleArray(3, 1) = "LastLongitude"
'//tells MapPoint to use this field as the longitude field
myExampleArray(3, 2) = geoFieldLongitude

'// Change the mousepointer
Screen.MousePointer = vbHourglass
Set objDataSet = objDataSets.LinkData(App.Path & "\1Logs.txt", "UnitID",
, geoCountryCanada, geoDelimiterComma)
objDataSet.Symbol = 83
objDataSet.Name = "Filtered"
Set objRecordset = objDataSet.QueryAllRecords
arArray = Array(objDataSet.Fields(1))

'Set which fields will be visible in the Pushpin balloon
objDataSet.SetFieldsVisibleInBalloon arArray
Do Until objRecordset.EOF
objRecordset.Pushpin.BalloonState = geoDisplayName
objDataSet.FieldNamesVisibleInBalloon = True

'// Change the mousepointer
Screen.MousePointer = vbNormal

Set objDataSet = Nothing
Set objRecordset = Nothing
End Sub
Function DSExist(nameDS As String) As Boolean
Dim countDS As Integer
Dim foundDS As Boolean
foundDS = False
For countDS = 1 To MappointControl1.ActiveMap.DataSets.Count
If MappointControl1.ActiveMap.DataSets(countDS).Name = nameDS Then
foundDS = True
Exit For
End If
DSExist = foundDS
End Function