Results 1 to 5 of 5
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Adding spaces (XP & 2000)

    In a report, I'm using an unbound text box to display the values from three fields in a table. Each value is a single-digit. In most cases, the text box will display just one digit, but some will display two or even three digits. In those cases where I need to display two or three digits, I need some space between them.

    What I have now is the following expression for this text box:

    =[Criterion1] & "" & [Criterion2] & "" & [Criterion3]

    Those double quotation marks are supposed to add space, just as if I were concatenating the parts of a person's name, right? Trouble is, I don't see the space--at least, not ENOUGH space. I do not want the result to appear as if it were a three digit number. I want the text box to display two or three digits as distinctly separate. How can I get the space I need?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Adding spaces (XP & 2000)

    The double quotes don't add anything except a zero-length string. If you want spaces, you'll have to add them between the quotes like this:

    <pre>=[Criterion1] & " " & [Criterion2] & " " & [Criterion3]</pre>

    Charlotte

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding spaces (XP & 2000)

    If you had Criterion1 and Criterion3 but no Criterion2 you would get a double space between the digits (after you correct as Charlotte says).

    The following is one way around this.
    =[Criterion1] & " " & [Criterion2] & iif(not isnull([Criterion2]; " ") & [Criterion3]

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Adding spaces (XP & 2000)

    Doh! Thanks, Charlotte!

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Adding spaces (XP & 2000)

    Thanks, Andy!

    I neglected to mention a few details. In this report, there will never be anything in Criterion3 if Criterion2 is null. Nonetheless, the information you gave me will no doubt be useful in other situations.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •