Access 2007 Filename Length

K

kmcphail

In Access 2007, trying to import a legit dbf file which has a file
name greater than 8 characters produces an error.

Going to External Data, Import, More, dBASE file if you select a legit
dbf file with a file name greater than 8 characters, it gives you an
error "The Microsoft Access database engine could not find the object
'zeroreserves05q5'. Make sure the object exists and that you spell
its name and the path correctly." The error code is 503011. If that
exact same dbf file is simply renamed to 8 or fewer characters, it
imports perfectly.

I have not been able to find anything in the knowledge base about this
or the error code. This occurs every time under the above conditions
on multiple computers using Access 2007. This does not occur using
Access 2003. Anyone else hitting this?
 
P

pietlinden

In Access 2007, trying to import a legit dbf file which has a file
name greater than 8 characters produces an error.

Going to External Data, Import, More, dBASE file if you select a legit
dbf file with a file name greater than 8 characters, it gives you an
error "The Microsoft Access database engine could not find the object
'zeroreserves05q5'. Make sure the object exists and that you spell
its name and the path correctly." The error code is 503011. If that
exact same dbf file is simply renamed to 8 or fewer characters, it
imports perfectly.

I have not been able to find anything in the knowledge base about this
or the error code. This occurs every time under the above conditions
on multiple computers using Access 2007. This does not occur using
Access 2003. Anyone else hitting this?

One option is to do something like this...
1. store the original filename in a string variable.
2. use REN to rename the file to an 8.3 format temporarily
3. Import the file
4. use REN again to rename the file back to the name you stored in
step 1.

PITA, sure. But it would work, and you could automate the processing
of an entire folder at a time...
 
P

Paul Shapiro

The renaming suggestion sounds like a good fix. dBase was a DOS database, so
maybe that's why the driver only uses the 8.3 file name. You could try
retrieving the short file name from a windows api to see if that would work,
but I think the renaming is simpler.
 
L

Larry Daugherty

Just guessing here but it could be that they've enhanced their
protection of you (from your own carelessness or stupidity) :)
that the "protection" is the problem. If you chose to import a file
that was limited to 8.3 in its original form they may be deciding for
you that long filenames weren't legal in the native format ergo you're
doing something *wrong*.

With the best of motivations we sometimes do the same thing to the
users of our applications.

HTH
 
P

Pieter Wijnen

Getting the Shortname should work

Private Declare Function APIGetShortPath Lib "kernel32" Alias
"GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As
String, ByVal cchBuffer As Long) As Long


Public Function GetShortPath(ByVal LongName As String) As String
On Local Error Resume Next
Dim ShortName As String * 256
APIGetShortPath LongName & VBA.vbNullChar, ShortName, VBA.Len(ShortName)
GetShortPath = VBA.Left(ShortName, VBA.InStr(ShortName, VBA.vbNullChar) -
1)
End Function

pieter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top