Public Function getParent(path As String) As String
If Right(path, 2) = ":\" Then '判读是否已经是根目录
getParent = ""
Exit Function
End If
If Right(path, 1) = "\" Then '去除最后一个\
path = Left(path, Len(path) - 1)
End If
path = Left(path, InStrRev(path, "\") - 1) '取父目录
If Right(path, 1) = ":" Then
path = path + "\"
End If
getParent = path
End Function
Dim FileName As String, FilePath As String
FileName = "c:\text\a.txt"
FilePath = Left(FileName, InStrRev(FileName, "\") - 1)
MsgBox FilePath
你字段是程序里面加上去的,看情况应该没连上数据库,所以得不到库里的数据,你把源文件拷过去看看数据库连上了没?一步步调试吧