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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF STATEMENT

Status
Not open for further replies.

99Chuck99

Programmer
Dec 11, 2003
67
US
I have a facility number that might have 3 digits, If so I would like to append leading zeros to make all consitant as 5 digits this is what I have been working with, but no Luck. Any assitance would be greatly appricaited.

test: IIf(Len([Facility]=3),Format([Facility],"00000"),[facility])
 
Looks like your first closing bracket is in the wrong place:
Code:
IIf(Len([Facility][COLOR=red])[/color]=3,Format([Facility],"00000"),[facility])


 
Why would you want to format it as a constant five digits only if the length is 3? What if it's 2 or 4? Why not:

Format([Facility], "00000")

that way it's ALWAYS five not matter what the length is....




Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top