jacobus_strydom

VBscript to calculate field

Discussion created by jacobus_strydom on Jan 6, 2011
Latest reply on Feb 24, 2011 by nbanerjee
Hi,

I???m having trouble with the field calculator function I???m using in my VB code.
It calculates to field but closes all user forms.

Can someone give me an example of code on how to calculate the selected records in a attribute table please.

Below is my code, but like I said it???s not working so I want to replace it with some thing better.

'Private Sub CalcTeam_1_Click()
-------------------------------------------------------
calculate points to Team_1
' --------------------------------------------------------'

Create the Geoprocessor object
Set GP = CreateObject("esriGeoprocessing.GPDispatch.1")

' Load required toolboxes...
GP.AddToolbox "C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx"
GP.AddToolbox "C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx"

' Local variables...
PointsNE_ = "PointsNE_"
PointsNE___2_ = "PointsNE_"
Team_1_shp = "C:\IssueTo\Team_1.shp"
PointsNE___3_ = "PointsNE_"

' Process: Calculate Field...
GP.CalculateField_management PointsNE_, "AllocatedT", """Team_1""", "VB"

End Sub

Outcomes