Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Atlanta, Georgia, USA
    Posts
    274
    Thanks
    0
    Thanked 0 Times in 0 Posts

    InStr Question (Access97/00)

    I have some strings like:
    RA25840*1*G0133813 or
    RA29014*10*A0485
    I need to extract the last portion of the string after the last *
    I've used InStr to get rid of one occurance of a character but can't figure out how to get rid of 2 in one operation.

  2. #2
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    Faifax, Virginia, USA
    Posts
    542
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: InStr Question (Access97/00)

    Would nesting the calls work? something like
    result = Instr(1,Instr() etc.)

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: InStr Question (Access97/00)

    Use :
    Mid("RA25840*1*G0133813",InstrRev("RA25840*1*G0133 813","*")+1)
    Francois

  4. #4
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Atlanta, Georgia, USA
    Posts
    274
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: InStr Question (Access97/00)

    What is InstrRev?

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: InStr Question (Access97/00)

    From the help file :
    Returns the position of an occurrence of one string within another, from the end of string
    Francois

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: InStr Question (Access97/00)

    I just check it out, it's a new function in Access 2000. If you need code for 97 use this as function :
    <pre>Function EndOfString(strPased As String) As String
    Do While InStr(strPased, "*") <> 0
    strPased = Mid(str, InStr(strPased, "*") + 1)
    Loop
    EndOfString = strPased
    End Function</pre>

    Francois

  7. #7
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Atlanta, Georgia, USA
    Posts
    274
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: InStr Question (Access97/00)

    Francois,
    That function worked great. I still found no reference to InstrRev in Access 2000 help file.
    Thanks,
    Scott

  8. #8
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: InStr Question (Access97/00)

    You have to look in the help file when you are in VBA.
    Help files since Access 2000 are only good to <img src=/S/toilet.gif border=0 alt=toilet width=24 height=26>
    Francois

Posting Permissions

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