Using VBA in field calculator I am trying to figure out the expression that if 3 conditions are met populate a field using another field's value and I cant get it to work! CALC_CLASS is a joined table and SPEED LIMIT is a Double type, MMS_TEMP is text.
I am using VBA and ARC 10.3
if [SPEED_LIMIT]=>91 and [SPEED_LIMIT] <= 100 and [MMS_TEMP]="53,000 or more" then
RD_BASELINE.CLASS_MMS= [CALC_CLASS_MMS.PSL_91_100]
elseif [SPEED_LIMIT]=>51 and [SPEED_LIMIT] <= 60 and [MMS_TEMP]="53,000 or more" then
RD_BASELINE.CLASS_MMS= [CALC_CLASS_MMS.PSL_51_60]
else
RD_BASELINE.CLASS_MMS=[CALC_CLASS_MMS.PSL_1_40]
end if**
Best Answer
I think what is happening here is that you have entered all your worflow in the pre-logic script and then told the calculator that
RD_BASELINE.CLASS_MMS=RD_BASELINE.CLASS_MMS
, which doesn't mean anything. This pre-logic script is run BEFORE the operation takes place. To make this work, you need to define a function in the pre-logic script code, and then call that function using the expression. I don't code much in VB, but in python, I would try:Then, in the expression field, just enter:
You can find lots VB examples for the field calculator here if you want to stick to that language.