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 = 

1 Answer 1


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
  • It worked! I have no idea why, but it did, thanks!
    – olcoil
    Commented Dec 14, 2012 at 18:32
  • 4
    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
    Commented Dec 14, 2012 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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