0

Anyone see a problem with the following code. I keep getting a 999999 - invalid character error.

Select Case [code]
  case 5112: x = "AP030"   ' trunk<br /> 
  case 5113: x = "AP030"   ' primary<br /> 
  case 5113: x = "AP030"   ' primary<br /> 
  case 5114: x = "AP030"   ' secondary<br /> 
  case 5115: x = "AP030"   ' tertiary<br /> 
  case 5121: x = "AP030"   ' unclassified<br /> 
  case 5122: x = "AP030"   ' residential<br /> 
  case 5123: x = "AP050"   ' living_street<br /> 
  case 5124: x = "AP050"   ' pedestrian<br /> 
  case 5131: x = "AP030"   ' motoway_link<br /> 
  case 5132: x = "AP030"   ' trunk_link<br /> 
  case 5133: x = "AP030"   ' primary_link<br /> 
  case 5134: x = "AP030"   ' secondary_link<br /> 
  case 5135: x = "AP030"   ' tertiary_link<br /> 
  case 5141: x = "AP030"   ' service<br /> 
  case 5142: x = "AP050"   ' track<br /> 
  case 5143: x = "AP010"   ' track_grade1<br /> 
  case 5144: x = "AP010"   ' track_grade2<br /> 
  case 5145: x = "AP010"   ' track_grade3<br /> 
  case 5146: x = "AP010"   ' track_grade4<br /> 
  case 5147: x = "AP010"   ' track_grades5<br /> 
  case 5151: x = "AP050"   ' bridleway<br /> 
  case 5152: x = "AP050"   ' cycleway<br /> 
  case 5153: x = "AP050"   ' footpath<br /> 
  case 5154: x = "AP050"   ' path<br /> 
  case 5155: x = "AQ150"   ' steps<br /> 
  case 5199: x = "AP050"   ' unkknown<br /> 
end select

Field Calculator

  • shouldn't it be Select Case code – nmtoken Nov 25 '16 at 22:41
  • No ... "code" needs to be in brackets [code], in vba. That much I'm pretty sure – Jeff Nov 26 '16 at 2:51
1

I tested your code, output:

enter image description here

Nothing wrong with it.

Just retype first line, or insert empty line after it. Some sort of a hidden character I guess:

Select Case [code]
  case 5112: x = "AP030"   ' trunk<br /> 
  case 5113: x = "AP030"   ' primary<br /> 
  case 5113: x = "AP030"   ' primary<br /> 
  case 5114: x = "AP030"   ' secondary<br /> 
  case 5115: x = "AP030"   ' tertiary<br /> 
  case 5121: x = "AP030"   ' unclassified<br /> 
  case 5122: x = "AP030"   ' residential<br /> 
  case 5123: x = "AP050"   ' living_street<br /> 
  case 5124: x = "AP050"   ' pedestrian<br /> 
  case 5131: x = "AP030"   ' motoway_link<br /> 
  case 5132: x = "AP030"   ' trunk_link<br /> 
  case 5133: x = "AP030"   ' primary_link<br /> 
  case 5134: x = "AP030"   ' secondary_link<br /> 
  case 5135: x = "AP030"   ' tertiary_link<br /> 
  case 5141: x = "AP030"   ' service<br /> 
  case 5142: x = "AP050"   ' track<br /> 
  case 5143: x = "AP010"   ' track_grade1<br /> 
  case 5144: x = "AP010"   ' track_grade2<br /> 
  case 5145: x = "AP010"   ' track_grade3<br /> 
  case 5146: x = "AP010"   ' track_grade4<br /> 
  case 5147: x = "AP010"   ' track_grades5<br /> 
  case 5151: x = "AP050"   ' bridleway<br /> 
  case 5152: x = "AP050"   ' cycleway<br /> 
  case 5153: x = "AP050"   ' footpath<br /> 
  case 5154: x = "AP050"   ' path<br /> 
  case 5155: x = "AQ150"   ' steps<br /> 
  case 5199: x = "AP050"   ' unkknown<br /> 
end select
  • Well it looks as though you may have something. I retyped the first couple of lines and it ran fine - odd?? Good suggestion. – Jeff Nov 26 '16 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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