Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Oct 2009
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi sure this is easy if you know how - am trying to crop the last 6 digits from a variable sized text string using a query grid..., have tried various things such as Right, Trim, etc., but not getting there..

    I'm sure there's a function to do this - can you help please?

    Much obliged.

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The variability of length of the string should not matter since you are grabbing the last 6 characters. Variability comes into play when you are trying to take a portion from the middle.

    RIGHT([field],6) should do the job.or try Right(Trim([field]),6) in case there are trailing spaces.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Right([field],6) will return the last 6 characters.
    My understanding is that you want to remove the last 6 characters, and return what is left.

    Left([field], Len([field])-6)

    Will there ever be cases where the field is not 6 chars long?
    Regards
    John



  4. #4
    Lounger
    Join Date
    Oct 2009
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [

    Much obliged John - yes that will do it - no there is never an instance of a null value or less than 6 so should be good.

Posting Permissions

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