Problems with Set-up wizard and long file names
Hi Keri,
According to
http://support.microsoft.com/support/kb/articles/q174/4/95.asp
There is no option in the Setup Wizard program that enables you to copy the
long file names in the Add Files list box to the disk images.
There are a couple of other inconsistencies re: long filename and short
filename, such as in Currentdb.name.... Sorry I couldn't give you a more
conclusive answer.
You can try wrapping each filename in fGetLongName function included here.
Hopefully that should do the job.
Dev
'********* Code Start ************
Private Declare Function apiFindFirstFile Lib "kernel32" _
Alias "FindFirstFileA" _
(ByVal lpFileName As String, _
lpFindFileData As WIN32_FIND_DATA) _
As Long
Private Declare Function apiFindClose Lib "kernel32" _
Alias "FindClose" _
(ByVal hFindFile As Long) _
As Long
Function fGetLongName(ByVal strFileName As String) As String
Dim lpFindFileData As WIN32_FIND_DATA
Dim strPath As String, lngRet As Long
Dim strFile As String, lngX As Long, lngY As Long
Dim strTmp As String
strTmp = ""
Do While Not lngRet = INVALID_HANDLE_VALUE
lngRet = apiFindFirstFile(strFileName, lpFindFileData)
strFile = Left$(lpFindFileData.cFileName, _
InStr(lpFindFileData.cFileName, _
vbNullChar) - 1)
If Len(strFileName) > 2 Then
strTmp = strFile & "\" & strTmp
strFileName = fParseDir(strFileName)
Else
strTmp = strFileName & "\" & strTmp
Exit Do
End If
Loop
fGetLongName = Left$(strTmp, Len(strTmp) - 1)
lngY = apiFindClose(lngRet)
End Function
Function fParseDir(strInFile As String) As String
Dim intLen As Long, boolFound As Boolean
Dim i As Integer, f As String, strDir As String
intLen = Len(strInFile)
If intLen > 0 Then
boolFound = False
For i = intLen To 1 Step -1
If Mid$(strInFile, i, 1) = "\" Then
f = Mid$(strInFile, i + 1)
strDir = Left$(strInFile, i - 1)
boolFound = True
Exit For
End If
Next i
End If
If boolFound Then
fParseDir = strDir
Else
fParseDir = strInFile
End If
End Function
'************ Code End **********
HTH
--
Dev Ashish (Just my $.001)
---------------
The Access Web ( http://home.att.net/~dashish )
---------------
Quote:
>Bug?
>When you create a Set Up file, if your .mdb file has a long file name,
>it will be given one of those swell ~ names on the "images" file. When
>set-up is run, however, those ~ names are changed back to the original
>long name. This is the behavior documented by Microsoft, and it is
>indeed what happened.
>The PROBLEM, however, is that the name is not "fully" changed back.
>When code calls this statement, the file can not be found.
>OpenDatabase(path & "LONGFILENAME.mdb")
>However, when I change the code to this, it opens right up.
>OpenDatabase(path & "LONGFI~1.mdb")
>Even more *interesting* is the fact that the long-named db's are
>back-end db's and the attachments to them (which use the long name) are
>working just fine. It's only in code that the long name is not
>recognized.
>Does anyone know a way to fix this so the long name can be used? Or are
>we doomed to short file names if we want to create a setup file and
>reference the db in code?
>Thanks for any ideas.
>Keri Hardwick