|
-
Nov 10th, 2000, 02:51 PM
#1
Thread Starter
Member
How do I go about using the instrrev function in my Access'97 VBA. It won't let me use it right now.
Matt
-
Nov 10th, 2000, 02:59 PM
#2
Fanatic Member
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
-
Nov 10th, 2000, 03:41 PM
#3
Thread Starter
Member
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
-
Nov 10th, 2000, 04:03 PM
#4
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
-
Nov 10th, 2000, 04:05 PM
#5
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
-
Nov 10th, 2000, 05:05 PM
#6
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|