Len and left function- result #Error.

  • Thread starter mohsin via AccessMonster.com
  • Start date
M

mohsin via AccessMonster.com

Hi

I'm using len and left function to get a value but the result is #Error.
The RATE is in TEXT format with value like 64K,256K. the idea is to get only
64 or 256 and change to numbers.

The code i'm using as below;

IIf(Len([A]![RATE]>3),Clng(Left([A]![RATE],3)),Clng(Left([A]![RATE],2)))

can some guide me please, what is the error?

thank you very much,

-mohsin
 
W

Wolfgang Kais

Hello Mohsin.
I'm using len and left function to get a value but the result is
#Error. The RATE is in TEXT format with value like 64K,256K. the
idea is to get only 64 or 256 and change to numbers.

The code i'm using as below;

IIf(Len([A]![RATE]>3),Clng(Left([A]![RATE],3)),Clng(Left([A]![RATE],2)))

IIf(Len([A]![RATE])>3,Clng(Left([A]![RATE],3)),Clng(Left([A]![RATE],2)))
 
J

John Spencer

Try using the Val function.

Val("25") returns 25
Val("25K") returns 25
Val("") returns 0
Val(Null) returns an error



'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
M

mohsin via AccessMonster.com

Hi john

Is work with Val(field), without any "",

Thank you very much indeed.
-mohsin

John said:
Try using the Val function.

Val("25") returns 25
Val("25K") returns 25
Val("") returns 0
Val(Null) returns an error

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
[quoted text clipped - 11 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top