How do I go about using the instrrev function in my Access'97 VBA. It won't let me use it right now.
Matt
Printable View
How do I go about using the instrrev function in my Access'97 VBA. It won't let me use it right now.
Matt
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.
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
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
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
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.