Results 1 to 6 of 6

Thread: instrrev

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2000
    Location
    Chicago
    Posts
    59

    Unhappy

    How do I go about using the instrrev function in my Access'97 VBA. It won't let me use it right now.

    Matt

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    I think INSTRREV is only supported by Office2000 and VB6 and up.

    You can create your own INSTRREV function by using a FOR LOOP with STEP -1.

    If you don't know how, post again and I will create one for you.
    Chemically Formulated As:
    Dr. Nitro

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2000
    Location
    Chicago
    Posts
    59
    I tried using an InstrRev Function made by Ian17 I found in the forum, but i don't think it works that effectively. I'm still trying to figure it. It would help me a lot if you could post your instrRev function too.

    thanks,
    Matt


  4. #4
    Guest
    Here is an InstrRev function from MSDN
    Code:
    Public Function InStrRev(ByVal sIn As String, sFind As String, _
     Optional nStart As Long = 1, Optional bCompare As _
          VbCompareMethod = vbBinaryCompare) As Long
        Dim nPos As Long
        sIn = StrReverse(sIn)
        sFind = StrReverse(sFind)
        nPos = InStr(nStart, sIn, sFind, bCompare)
        If nPos = 0 Then
            InStrRev = 0
        Else
            InStrRev = Len(sIn) - nPos - Len(sFind) + 2
        End If
    End Function

  5. #5
    Guest
    I just realized you need a function called StrReverse which is used in the above example.
    Code:
    Public Function StrReverse(ByVal sIn As String) As String
        Dim nC As Integer, sOut As String
        For nC = Len(sIn) To 1 Step -1
        sOut = sOut & Mid(sIn, nC, 1)
        Next
        StrReverse = sOut
    End Function

  6. #6
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    The one that I was going to post is similar to the second one the Megatron posted. That should be almost equivalent to INSTRREV function.
    Chemically Formulated As:
    Dr. Nitro

Posting Permissions

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



Click Here to Expand Forum to Full Width