문제

I have Excel export within Access 2007. The only thing I am not entirely sure about is I have value that appears as an age, for example "1-3", this obviously becomes higher dependent on customer selection.

I want two IIf statements: one to select the data before the "-" and one for after "-", can anyone help?

도움이 되었습니까?

해결책 2

IIf(IsNull([strAge]),"",Left([strAge],InStr(1,[strAge],"-")-1)) 

IIf(IsNull([strAge]),"",Mid([strAge],InStr(1,[strAge],"-")+1)) 

다른 팁

You could

select
  T.agerange, 
  iif(agerange is null, "", left(agerange,instr(agerange,"-")-1)), 
  iif(agerange is null, "", mid(agerange,instr(agerange,"-")+1))
from T;

however a 2 column design would be far superior.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top