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

Why does this statement produce an indented line? 2

Status
Not open for further replies.

micereza

Technical User
Jul 27, 2002
14
US
I've created a statement in my report that pulls from multiple fields and removes unecessary spaces. Example:

=IIf(IsNull([English Speaking]),""," " & [English Speaking]) & IIf(IsNull([Spanish Speaking]),""," " & [Spanish Speaking]) & IIf(IsNull([French Speaking]),""," " & [French Speaking]) & IIf(IsNull([Creole Speaking]),""," " & [Creole Speaking]) & IIf(IsNull([Chinese Speaking]),""," " & [Chinese Speaking])

My only problem is that when the results are returned the first line is indented by one character. Example:

English Speaking, French Speaking,
Spanish Speaking, Chinese Speaking, etc...

Why is this happening? More importantly, what is a simple way to stop this from happening?

 
[EnglishSpeaking] probably isn't Null, but rather an empty string ("") which would make your IIF evaluate to true and return a space (" ") and the value of [EnglishSpeaking]. I would try this:
=IIf(IsNull([English Speaking]) OR ([English Speaking]=""),""," " & [English Speaking]) ....(change the other IIF's accordingly).

Let me know if this helps.
 
With this syntax you are always starting your line with a " ". Try this instead:
Code:
=IIf(IsNull([English Speaking]),"",[English Speaking] & " ")
 
or - just pull the iffy pile into a module and code it. then you could easily step through the various items and see what is going on. it would also be MUCH easier to modify thie type of construct (Nested logic) in the future - which is an almost certanity in the life of complex expressions.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top