In this example we will remove a file extension from filename using a few different functions.
We will use Left and InStrRev.
If we get the position of the last dot (.) in the Filename we can then use that to remove it from the whole string.
This will return where the dot (.) is so we need to remove that as well so that is why we minus 1 from that
value and now we can use the Left function to get just the File.
VBA
'Filename = "test.doc"
'12345678
'test.doc
Public Function GetFilename(Filename) As String
Dim File As String
Dim dotpos As Integer
dotpos = InStrRev(Filename, ".") '5
Dim JustFile As String
JustFile = Left(Filename, dotpos - 1) '5-1 = 4
'Join these together
File = Left(Filename, InStrRev(Filename, ".") - 1)
GetFilename = File
End Function
You could call this Function in a Query or a Form. =GetFilename("test.doc")