Reputation: 821
Access VBA has Instr to return the position of the first occurrence of a string in another string.
Instr ( [start], string_being_searched, string2, [compare] )
Is there any method to return the position of the last occurrence of a string in another string?
Upvotes: 13
Views: 27478
Reputation: 104
Check this link, example code from MS
https://msdn.microsoft.com/en-us/library/t2ekk41a(v=vs.90).aspx
Dim TestString As String = "the quick brown fox jumps over the lazy dog"
Dim TestNumber As Integer
' Returns 32.
TestNumber = InStrRev(TestString, "the")
' Returns 1.
TestNumber = InStrRev(TestString, "the", 16)
Upvotes: 4