CurrentDB.Name returns 8.3 format

J

John Donofrio

I am verifying/updating links in an excel file and in
order to verify the links are accurate, I am using the
subject property. The only problem is that the link(s)
datasource in excel is a long path/filename and
CurrentDB.Name returns a DOS 8.3 path/filename. Because of
this, a comparison of the two is not equal even though
they point to the same file.

Any ideas?

Thanks in advance.
John
 
D

Douglas J. Steele

IIRC, what CurrentDB.Name returns depends on how you opened it. If you
simply double-clicked on the file in Windows Explorer, you'll usually get
the DOS 8.3 filename (because the file association isn't done correctly, in
actual fact).

There's code at http://www.mvps.org/access/api/api0020.htm at "The Access
Web" to allow you to switch back and forth between short and long file
names.

If you're interested, the file association fix is to put quotes around the
%1 that should be present in the Open command. In my case, it meant a change
from

C:\MSOff32.972\Office\MSACCESS.EXE /NOSTARTUP %1

to

C:\MSOff32.972\Office\MSACCESS.EXE /NOSTARTUP "%1"
 
J

John Donofrio

I thank you for a quick response.

Since I do not know how the user(s) will open the DB, I
think it is best that I implement a function that converts
both to either the long or the short name. (Thanks for the
link)

After reading your explanation of why this is happening, I
thought of changing the registry with code. However, I
cannot guarantee the user(s) will have the required rights
to change the registry.

Thanks again for the help!
John
-----Original Message-----
IIRC, what CurrentDB.Name returns depends on how you opened it. If you
simply double-clicked on the file in Windows Explorer, you'll usually get
the DOS 8.3 filename (because the file association isn't done correctly, in
actual fact).

There's code at
http://www.mvps.org/access/api/api0020.htm at "The Access
 
Top