mustol

Calculate Field syntax problem?

Discussion created by mustol on Jun 6, 2011
Latest reply on Jun 8, 2011 by mustol
I have created a model in Model Builder (Arc 9.2), which includes 3 Calculate Field tools, 2 of which work, but the 3rd doesn't. A shortened version of the VB code entered in the Code Block box for that tool is shown below:

Select Case (DatePart("yyyy", Now( )) - DatePart("yyyy", [DATE_TIME]))

Case 1
Class = 0
Case 2
Class = 1
Case 3 To 15
Class = 2
Case Is > 15
Class = 3
Case Else
Class = 4

End Select

The Model fails on running this tool and it appears it doesn't like both 'Case 3 To 15' and 'Case Is > 15'. I tried the Model on 3 other PCs, it failed on 2, but worked on 1 of them (same Product Version, Service Pack etc.). Has anybody got an idea why this might be failing? As far as I can see the syntax is correct. The actual tool has many more Cases, so using an If..Then statement would be very long-winded.

Outcomes