Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Lexington Park, Maryland, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Grabbing certain number of Characters from Strings (Access 2000)

    I need to be able to determine if the last 7 characters of a string is equal to " WHERE ". How do I do this?

    Mike

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Grabbing certain number of Characters from Strings (Access 2000)

    <code>
    If Right(strMyString,7) = "Where" Then
    </code>
    Legare Coleman

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

    Re: Grabbing certain number of Characters from Strings (Access 2000)

    You can use Right(expression,7) to return the last 7 characters of expression

    If you tell us how you want to use this, we may be able to offer more specific help.

  4. #4
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Lexington Park, Maryland, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Grabbing certain number of Characters from Strings (Access 2000)

    that is exactly what I wanted. I am just using this to determine what comes next in an SQL statement. The only question I have would be will this function pick up the spaces in " WHERE " before and after the word?

    Thanks

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Grabbing certain number of Characters from Strings (Access 2000)

    Yes, as Hans and I wrote it, it will pick up the last seven characters whatever they are. If you don't want the trailing space, then you could use something like:

    <code>
    Right(Trim(strMyString),7)
    </code>
    Legare Coleman

  6. #6
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Lexington Park, Maryland, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Grabbing certain number of Characters from Strings (Access 2000)

    That worked great.

    Thanks

Posting Permissions

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