Select to view content in your preferred language

Indexing string field script causes Arcpad crash

534
0
11-27-2013 04:49 PM
SteveFitzgerald
Occasional Contributor
Hi,
I'm trying to add/remove shapefile indexes using a vbscript in Arcpad 7.01 or 8.0 (sp 4).
I've only tried it on Windows 7 and XP and it causes Arcpad to crash on both occasions.
It crashes when attempting to add the index. The progress bar appears and just stays there (win 7 calls a crash while xp is happy to leave it at that).
When Arcpad is opened again it has actually created the index and it can then be deleted using the code with no problem.
Any ideas welcome!

Function DoIndex
 Dim theMap, rs

 fieldName = "Name"
 Set theMap = Map.Layers("trees.shp")

 Set rs = theMap.Records

 If rs(fieldName).HasIndex Then

  If theMap.CanEdit = True then

   DoIndex = rs(fieldName).DeleteIndex

   msgbox "Index deleted!"

  Else
  
   Msgbox "Layer " & theMap.Name & " cannot be set to edit mode!",vbInformation,"Layer not indexable"
   
   DoIndex = False
   
  End if
 Else

  If theMap.CanEdit = True then

   DoIndex = rs(fieldName).BuildIndex

   msgbox "Index built!"
  Else
  
   Msgbox "Layer " & theMap.Name & " cannot be set to edit mode!",vbInformation,"Layer not indexable"
   
   DoIndex = False
   
  End if

 End if
 
 Set rs = Nothing
 Set theMap = Nothing
End Function
Tags (3)
0 Kudos
0 Replies