Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
Else
 X = CapitalDia
End If

And then, the bottom window is

Final_Dia = 
X
share|improve this question

1 Answer 1

up vote 5 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 = [DIAMETER_1]
else
 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
2  
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

 
discard

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.