Using a New Line Character in Expression Builder

Posted on 2007-07-30
Last Modified: 2013-11-28
Ok, here is my problem.  I have one text box that I'm joining multiple fields into with IIf() statements.  The problem is I need each field to appear on a new line.  For example;

IIf(field1 = "A","A",Null) & IIf(field2 = "C","C",Null)

I need the results to appear like this following, assuming both statements are true.


Is there a 'New Line' character that I can use between the IIf statements to display the results on a seperate line.

Question by:jdobbs88
    LVL 61

    Accepted Solution

    Try this:
    IIf(field1 = "A","A",Null) & vbcrlf &  IIf(field2 = "C","C",Null)


    IIf(field1 = "A","A",Null) & CHR(10) & chr(13) &  IIf(field2 = "C","C",Null)   '* Chr(10) and chr(13) may need to be reversed

    LVL 44

    Expert Comment

    Maybe this:

    If(field1 = "A","A" & vbcrlf,Null) & IIf(field2 = "C","C" & vbcrlf,Null)) . etc.  This will leave a 'blank' line at the end.  Is that OK?
    LVL 10

    Expert Comment

    This Might also wok

    IIf(field1 = "A","A"&(Chr(13)),Null) & IIf(field2 = "C","C"&(Chr(13)),Null) ....

    Hope this helps,


    Author Comment

    Thanks for the help everyone.  I tried all three examples and the only one that worked was a combination of CHR(10) & CHR(13)

    Thanks again for everyone's help
    LVL 61

    Expert Comment

    Glad to help
    LVL 10

    Expert Comment

    Sorry for posting the same answer twice!

    I had not full read mbizup's first post


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    Article by: Leon
    Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
    The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
    The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now