Access VBA find the last occurrent of a string?
Try InstrRev
instead - see here
Note the different syntax to InStr
:
InstrRev(stringcheck, stringmatch[, start[, compare]])
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)