Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can't figure out why the syntax is wrong in Field Calculator ArcMap 10. The complete codeblock is

Dim CapitalDia As Number
Dim TwagDia As Number
Dim X As Number

CapitalDia = [New_Pipe_S]
TwagDia = [DIAMETER_1]

If CapitalDia= 0 Then
 X = TwagDia
 X = CapitalDia
End If

And then, the bottom window is

Final_Dia = 
share|improve this question
up vote 7 down vote accepted

The "as Number" is what's causing the error. Just use "dim X"

dim X

if [New_Pipe_S] = 0 then
 X = [New_Pipe_S]
end if
share|improve this answer
It worked! I have no idea why, but it did, thanks! – olcoil Dec 14 '12 at 18:32
In version 10, support for VBA was dropped but you can still use VBScript. Dimensioning a variable as a particular object type is VBA. – mkennedy Dec 14 '12 at 20:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.