Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does LEN return? 2

Status
Not open for further replies.

JS1521253

Technical User
Jun 9, 2009
10
US
I am trying to use the following formula within a query:

Code:
IIf(IsNumeric([AccountNumber]),IIf(Len([AccountNumber]=10),"1","0"),"0")

Ultimately, I am trying to create a case hit that shows that the accountnumber is numeric and is 10 numbers long. I continue to get a Data Match error. I want to count the number of characters in my AccountNumber. Any ideas?

Thanks
 
Code:
IIf(IsNumeric([AccountNumber]),IIf(Len([AccountNumber][!])[/!]=10,"1","0"),"0")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Are you trying to use the results to count the number of account numbers that are formatted correctly? If so, you need to lose the quotes.


Randy
 
Thank you both. I had been staring at this forever, but couldn't see the goofy mistakes.

Just to complete the thread I've included the final code:

Code:
IIf(IsNumeric([PatientAccountNumber]),IIf(Len([PatientAccountNumber])=10,1,0),0)

Thanks again,
 
A shorter way:
Code:
IIf([PatientAccountNumber] Like '##########',1,0)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top