riamuyabu

VBS: Error 999999

Discussion created by riamuyabu on Oct 4, 2013
Hi,

My apologies in advance as I know this is the python section of the forum, but I couldn't find an area for VBS.

I have written a script for the model builder's calculate field function in vbscript but I keep getting the 999999 error.

I have gone over my code several times but cannot seem to find a reason for it not to be able to run.


INPUT TABLE: JOIN_CarData_RoadLinks
FIELD NAME: JOIN_CarData_RoadLinks.OrientationOfCar
EXPRESSION: CarOrientation
Dim CarOrientation

Dim RoadOrientation
RoadOrientation = [JOIN_CarData_RoadLinks.Orientation]

// Orientation is a string field that contains either a "-" or a "+".

Dim RoadCompass
RoadCompass = [JOIN_CarData_RoadLinks.CompassA]

// CompassA is a double.

Dim RoadCompassMax
RoadCompassMax = RoadCompass + 170

 If RoadCompassMax > 360 Then
 RoadCompassMax = RoadCompassMax - 360
 ElseIf RoadCompassMax < 0 Then
 RoadCompassMax = RoadCompassMax + 360
 End If

Dim RoadCompassMin 
RoadCompassMin = RoadCompass - 170

 If RoadCompassMin > 360 Then
 RoadCompassMin = RoadCompassMin - 360
 ElseIf RoadCompassMax < 0 Then
 RoadCompassMin = RoadCompassMin + 360
 End If

Dim PointBearing
PointBearing = [JOIN_CarData_RoadLinks.Bearing]

// Bearing is a double.

If PointBearing > RoadCompassMin Then
 If PointBearing < RoadCompassMax Then
  CarOrientation = RoadOrientation
 End if
End if

If PointBearing < RoadCompassMin Then
 If PointBearing > RoadCompassMax Then
  If RoadOrientation = "-" Then
   CarOrientation = "+"
  End if

  If RoadOrientation = "+" Then
   CarOrientation = "-"
  End if
 End if
End if


I have tried including and excluding the "JOIN_CarData_RoadLinks." in my field allocations and replacing the declared variables used in the body of my code with the actual table's fields. I have copied my code into a VBScript IDE to check the syntax and it couldn't find anything wrong.

Any help would be appreciated, sorry again if this is not the correct section of the forums.

Thanks,


Liam.

Outcomes