Ok, here is replacement code for Access 97 Entry Point 59,
care of MVP Dirk Goldgar:
'----- start of code -----
Sub SplitPath( _
ByVal FilePath, _
ByRef strDrive As String, _
ByRef strFolder As String, _
ByRef strFilename As String, _
ByRef strExtension As String)
strDrive = fncSplitString(FilePath, ":")
If Len(FilePath) = 0 Then
FilePath = strDrive
strDrive = vbNullString
End If
strFolder = StrReverse(FilePath)
strFilename = fncSplitString(strFolder, "\")
If Len(strFolder) > 0 Then
strFolder = StrReverse(strFolder)
End If
strExtension = fncSplitString(strFilename, ".")
If Len(strFilename) = 0 Then
strFilename = StrReverse(strExtension)
strExtension = vbNullString
Else
strExtension = StrReverse(strExtension)
strFilename = StrReverse(strFilename)
End If
End Sub
Function fncSplitString(ByRef SourceString, ByVal Delimiter, _
Optional Compare As Integer = vbBinaryCompare) _
As String
' Splits <SourceString> at the first occurrence of
' <Delimiter>, returning all characters up to but not
' including <Delimiter>, and removing those
' characters plus the following <Delimiter> from <SourceString>. If
' <Delimiter> is not found, all of <SourceString> is returned, and
' <SourceString> is set to a zero-length string. The optional
' Parameter <Compare> may be specified to control whether a binary
' or text comparison is used to search for <Delimiter>, using the
' same values as are accepted by the Instr() function.
Dim lngPos As Long
lngPos = InStr(1, SourceString, Delimiter, Compare)
If lngPos = 0 Then
fncSplitString = SourceString
SourceString = ""
Else
fncSplitString = Left$(SourceString, lngPos - 1)
SourceString = Mid$(SourceString, lngPos + 1)
End If
End Function
'----- end of code -----
'Here's a routine to test it out:
'----- start of tester code -----
Sub SplitPathTest()
Dim strPath As String
Dim strDrive As String
Dim strFolder As String
Dim strFilename As String
Dim strFileExt As String
Do
strPath = InputBox("Enter path to parse:")
If Len(strPath) > 0 Then
SplitPath strPath, strDrive, strFolder, _
strFilename, strFileExt
MsgBox _
"drive=" & strDrive & vbCr & _
"folder=" & strFolder & vbCr & _
"filename=" & strFilename & vbCr & _
"extension=" & strFileExt
Else
Exit Do
End If
Loop
End Sub
'----- end of tester code -------
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Hope that gets you going,
--
Jeff Conrad
Access Junkie
Bend, Oregon
in message: