HOW TO
This article shows how to use ITable:UpdateSearchedRows to update the rows selected by a Query Filter.
Note:
Code in the ThisDocument module will only run in the current map document. To store the code in all your map documents, open the Normal.mxt ThisDocument code module.
Code:
Sub ChangeRows()
Dim pTC As ITableCollection
Dim pTable As ITable
Dim pMap As IMap
Dim pDoc As IMxDocument
Dim pRow As IRow
Dim pQF As IQueryFilter
Dim pRowBuff As IRowBuffer
'Get the first table from the map
Set pDoc = ThisDocument
Set pMap = pDoc.FocusMap
Set pTC = pMap
Set pTable = pTC.Table(0)
'Create a query filter to select rows
'to be updated
Set pQF = New QueryFilter
pQF.WhereClause = "TRACT_ID < 400"
'Create the row buffer and set the value for the field to update
Set pRowBuff = pTable.CreateRowBuffer
pRowBuff.Value(pTable.FindField("Edited")) = "Done"
'Update the rows
pTable.UpdateSearchedRows pQF, pRowBuff
End Sub
Get help from ArcGIS experts
Download the Esri Support App