• InStr Question (Access97/00)

    Author
    Topic
    #369801

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #583172

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

    • #583177

      Use :
      Mid(“RA25840*1*G0133813”,InstrRev(“RA25840*1*G0133813″,”*”)+1)

      • #583184

        What is InstrRev?

        • #583185

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

        • #583189

          I just check it out, it’s a new function in Access 2000. If you need code for 97 use this as function :

          Function EndOfString(strPased As String) As String
          Do While InStr(strPased, "*")  0
              strPased = Mid(str, InStr(strPased, "*") + 1)
          Loop
          EndOfString = strPased
          End Function
          • #583196

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

            • #583199

              You have to look in the help file when you are in VBA.
              Help files since Access 2000 are only good to toilet

    Viewing 1 reply thread
    Reply To: InStr Question (Access97/00)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: