Previous Thread

8/18/2006 1:45:14 PM    Re: import longfilename.DBF
Hi Kim, 
 
Is it possible that you were importing the files via ODBC rather than the 
 
native Dbase format? The FoxPro and Visual FoxPro ODBC driver is 
 
downloadable from msdn.microsoft.com/vfoxpro/downloads/updates/odbc. Post 
 
back if you have trouble setting up an ODBC data source. 
 
-- 
 
Cindy Winegarden  MCSD, Microsoft Most Valuable Professional 
 
cindy@cindywinegarden.com 
 
<Kim.Baker@exemail.com.au> wrote in message 
 
news:v1lae21eeibd388hsi2r4tm1tkc08brupp@4ax.com...



8/18/2006 3:51:28 PM    import longfilename.DBF
Hi Guys, 
 
I have recently reinstalled access after a computer crash and I can no 
 
longer import .DBF files that I have been using for years. 
 
I have found that renaming them into the 8.3 format allows me to 
 
import them however, there is critical information in the long file 
 
name that I manipulate through VBA. 
 
Could anyone tell me if there is an addin or update that allows long 
 
filename support i.e. 12.3 
 
I must have had this installed before but I cannot remember doing it. 
 
Thanks 
 
Kim 
 
PS Access 2002/XP is what I am using. 
 
Remove undies to reply

8/18/2006 5:52:52 PM    Re: import longfilename.DBF
Hi Kim, 
 
This VBA function takes an ordinary (long) filespec and returns the 
 
short path to the same file. It seems to work properly but hasn't been 
 
exhaustively tested. 
 
Function GetShortPath(ByVal FileSpec As String, _ 
 
Optional FailOnError As Boolean = False) 
 
Dim fso As Object 
 
Dim oFile As Object 
 
Dim oFolder As Object 
 
Dim S As String 
 
Dim Buf As String 
 
On Error GoTo ErrHandler: 
 
Set fso = CreateObject("Scripting.FileSystemObject") 
 
'Get a handle on the file 
 
Set oFile = fso.GetFile(FileSpec) 
 
Do 
 
FileSpec = fso.GetParentFolderName(FileSpec) 
 
If Len(FileSpec) = 0 Then Exit Do 
 
Set oFolder = fso.GetFolder(FileSpec) 
 
Buf = oFolder.ShortName & "\" & Buf 
 
Loop 
 
GetShortPath = oFile.Drive & Buf & oFile.ShortName 
 
Exit Function 
 
ErrHandler: 
 
If FailOnError Then 
 
Err.Raise Err.Number, "GetShortPath()", _ 
 
Err.Description & vbCrLf & "[In GetShortPath() function]", _ 
 
Err.HelpFile, Err.HelpContext 
 
Else 
 
Err.Clear 
 
GetShortPath = "" 
 
End If 
 
End Function 
 
On Fri, 18 Aug 2006 15:51:28 +1000, Kim.Baker@exemail.com.au wrote: 
 
-- 
 
John Nurick [Microsoft Access MVP] 
 
Please respond in the newgroup and not by email.