Dim intNumber As Integer
Dim strPath As String
Dim strFile As String
strPath = "C:\Temp\"
strFile = Dir(strPath & "*.CHK)
If Len(strFile) > 0 Then
intNumber = Mid(strFilePath, InStrRev(strFile, ".") - 3, 3)
End If
That's assuming there's only one .CHK file you interested in in that folder.
If there are multiple, use:
Dim intNumber As Integer
Dim strPath As String
Dim strFile As String
strPath = "C:\Temp\"
strFile = Dir(strPath & "*.CHK)
Do While Len(strFile) > 0
intNumber = Mid(strFilePath, InStrRev(strFile, ".") - 3, 3)
strFile = Dir()
Loop
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
obiwaugh said:
Alright...I don't think my original question was complete. In the code
you
supplied, it appears that I would need to enter the full path.
In my scenario, I will need the code to look in the specific folder and
pull
the 3 numbers from the file name. Yes, it's always the 3 digits before
the
extension.
Always 3 digits in front of the file extension? Try:
Mid(strFilePath, InStrRev(strFilePath, ".") - 3, 3)
Let's say that I have a file with path C:\TEMP\LRQAD362.CHK
[quoted text clipped - 3 lines]