Len Function

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

mohsin via AccessMonster.com

Hi there

How can I, make a queries for the variable length characters. The inputA
field have a length which between 6-4 characters.
I try to use below queries, but got #Errors,

IIF(Len(InputA=6,Left(InputA,6),Left(InputA,4))

How about if 5 characters? How can i put in the queries?

Please help,

Thank you
-Mohsin
 
M

Max

Hi ,
Please check syntex for iif(condition,true,false)

it should be

iif(Len(Input)=6,Left(Input,6),Left(Input,4))

max
 
J

John W. Vinson

Hi there

How can I, make a queries for the variable length characters. The inputA
field have a length which between 6-4 characters.
I try to use below queries, but got #Errors,

IIF(Len(InputA=6,Left(InputA,6),Left(InputA,4))

How about if 5 characters? How can i put in the queries?

I'm not quite sure what you're asking!

If you want to find all records in the table with the field of a particular
length, put a calculated field in the query by typing

LenOfA: Len([InputA])

in a vacant Field cell in the query grid. To find all records where InputA is
4 bytes long, put

4

on the criteria. For more flexibility put

[How many characters:]

on the criteria line; you'll be prompted, and can enter 4, 5 or 6 and get the
corresponding result. No IIF() call is needed.
 

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