Select to view content in your preferred language

Please Help! Delete Shapefile Record

2049
1
04-09-2010 07:00 AM
CarlPreusser
New Contributor
I have two point shapefiles displayed on my map.  They are identical with their lat/long.  I'm trying to write a VBscript which is called on the identify of one of the shapefiles.  I want the code to find the other shapefile point and delete that record.  The record shapefile I'm trying to delete is currently set to identifiable - false...

The following variable is not identified in the code section:

"o_i" is the ID from the identified feature shapefile

Here is the relevant portion of my code:

Dim city_
city_ = Application.UserProperties("city")

'This block of code checks to see if the MS4 shape file is present and as the outfalls are inspected...
'the points are removed from the shapefile to allow the inspector to visualize the inspections left...
Dim out_layer
Set out_layer =  Application.CreateAppObject("File")
Dim LyrExists_1
LyrExists_1 = out_layer.Exists (Application.UserProperties("ArcPad_Path") & "Data\City_Data\" & city_ & "\" & city_ & "_complete.shp")

  If LyrExists_1 = True Then
 
    Application.Map.Layers.Remove(city_ & "_complete.shp")
      
         Dim complete_file
         Set complete_file =  Application.Map.Layers(city_ & "_complete.shp").Records
             
           complete_file.Bookmark = complete_file.Find ("[OutfallID] = """ & o_i & """")
           complete_file.Delete
           complete_file.Update
           MsgBox "Record Deleted!"
              
            
          Application.Map.Refresh(True)

  End If
  Set complete_file = Nothing


This is returning a "Permission Denied" runtime error.........Can anyone explain this, or provide a solution on how I can remove this record from the shapefile?  I've tried many different options and am stumped.

Thanks
0 Kudos
1 Reply
CarlPreusser
New Contributor
I solved my own issue...I read another post which talked about making the layer editable first...That's what I did!
0 Kudos