Results 1 to 6 of 6

Thread: Any IDEA?

  1. #1
    Join Date
    Jan 2004
    Location
    Myanmar (Burma)
    Posts
    42

    Exclamation Unanswered: Any IDEA?

    Dear all Guru

    I add the expression to combine the titles in my query as follow:

    Title: [Title_1] & ', ' & [Title_2] & ', ' & [Title_3] & ', ' & [Title_4]

    The result is like that >> Title1, Title 2, Title Three, Title IV

    In some case, Title_2 and Title_4 do not have data.

    So the result become >> Title1, , Title Three,
    BAD

    How do I remove un-necessary ",".

    I wanna to get the result like that >> Title1, Title Three

    Thanks in advance.
    Cyber : The easiest place to make huge mistake.

  2. #2
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243

    Re: Any IDEA?

    Originally posted by mmlatt
    Dear all Guru

    I add the expression to combine the titles in my query as follow:

    Title: [Title_1] & ', ' & [Title_2] & ', ' & [Title_3] & ', ' & [Title_4]

    The result is like that >> Title1, Title 2, Title Three, Title IV

    In some case, Title_2 and Title_4 do not have data.

    So the result become >> Title1, , Title Three,
    BAD

    How do I remove un-necessary ",".

    I wanna to get the result like that >> Title1, Title Three

    Thanks in advance.


    At first sight, when there is no data, you will have 2 commas separated by a space.
    Because the result is a string, you can do a replace

    Code:
    Title: [Title_1] & ', ' & [Title_2] & ', ' & [Title_3] & ', ' & [Title_4]
    Title = Replace (Title, ", ," , "")
    This will replace the combination ", ,' by an empty string.

  3. #3
    Join Date
    Jan 2004
    Location
    Myanmar (Burma)
    Posts
    42
    Replace function work nice.
    Thanks alot artemide.
    Cyber : The easiest place to make huge mistake.

  4. #4
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243
    Originally posted by mmlatt
    Replace function work nice.
    Thanks alot artemide.

    What if title1 has no data --> there will be no combintion ", ,".
    Did you think of that?

  5. #5
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447
    To maek this stable, you should consider to take care of every title x like

    iif(IsNull([Title_x]), "", ", " & [Title_x])

    x>= 2, of course
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

  6. #6
    Join Date
    Jan 2004
    Location
    Myanmar (Burma)
    Posts
    42
    I don't worry about Title_1, 'cause it can't accept null value.


    thanks all
    Cyber : The easiest place to make huge mistake.

Posting Permissions

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