I don't think your code will work, Tony.
First of all, you're using the Right function, which will return an
ever-increasing substring, so it will never actually equal "\". And once
you've found the position of the slash, i is pointing to that slash, so you
want the Mid function to retrieve what's after that slash (i.e. i + 1) to
the end (which means you can skip supplying the last argument). You're also
not exiting the loop once you've found the first slash. I think you need:
For i = Len(strContainingPath) To 1 Step -1
If Mid(strContainingPath, i, 1)= "/" Then
Me.txtFieldShowingPath = _
Mid(strContainingPath, i + 1)
Exit For
End If
Loop
However, Access 2000 and newer have a InStrRev function that would probably
be more efficient:
Me.txtFieldShowPath = Mid(strContainingPath, InStrRev(strContainingPath,
"\") + 1)
And, as long as the file actually exists, in all versions of Access, you can
use the Dir function to return only the file name from a full path:
Me.txtFieldShowPath = Dir(strContainingPath)