Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Left,Right,Len (Acc2k)

    In one field of a database, we have the following string:

    AB/DW
    or
    DF/DW/DR
    or
    DF/NH/MJ/LK

    The length can vary.

    I can extract the left most two characters, ie : Est: (Left([EST_NME],2))
    and thought : Est: (Right([EST_NME],2)) would extract the last two, but it doesn't.

    Do I need to use "Len" and how, or is there another method available to extract what I need.

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Left,Right,Len (Acc2k)

    Your syntax looks OK, except for a couple of superfluous brackets. Are you sure it does not work. It does work for me.

    Est: Right([EST_NME],2)

    What does it actually return?


    You need to use Len, when you are trying to extract all except that last two, or all except the first two.
    Regards
    John



  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Left,Right,Len (Acc2k)

    Hi Dave,

    Right([EST_NME],2) ought to extract the last two characters of the field. If the result is not what you expected, perhaps the field contains trailing spaces, for example "AB/DW ". You could try
    <code>
    Est: Right(Trim([EST_NME]),2)
    </code>
    If that still doesn't do what you want, can you tell us what the result is?

  4. #4
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Left,Right,Len (Acc2k)

    John, Hans

    Thanks for the info.

    It was the spaces that caused the problem.
    I've also edited the brackets.

Posting Permissions

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