Import dbf file.

Hello guys. I have to import dbf files in NAV 5.0. There is no problem with files with name length 8 characters or less. But I can’t import files with length more than 8 characters. Is there any possibillity to do this? I can rename files but it’s not good solution.

I’ve never run into a problem with file name lengths in NAV. How are you importing the file? What error/issue is it having with the file names longer than 8 characters?

This is the code that i use to open file:
CLEAR(ADOConn);
CLEAR(ADORecSet);
CREATE(ADOConn);
CREATE(ADORecSet);
ConnStr := ‘Provider=Microsoft.Jet.OLEDB.4.0;Data Source=’ + FPath + ‘;’ +
‘Extended Properties=dBase IV; mode=Read|Write|Share Deny None;’ +
‘Locale Identifier=1058;’;
ADOConn.Open(ConnStr);
ADORecSet.ActiveConnection := ADOConn;
ADORecSet.Open(Filename);

IF the length of Filename > 8 i have the error


Microsoft Dynamics NAV

This message is for C/AL programmers:

The call to member Open failed. Microsoft JET Database Engine returned the following message:
Invalid SQL statement; expected ‘DELETE’, ‘INSERT’, ‘PROCEDURE’, ‘SELECT’, or ‘UPDATE’.


OK

I’ve done some searching and this is a known problem. For example:

http://www.mrexcel.com/forum/showthread.php?t=355455

As you’ve already figured out you will need to find a way to get the 8.3 name for the file. It could be as simple as changing “MyLongFileName.dbf” to “MyLong~1.dbf”. The only problem would be if the first 8 characters of the file name don’t uniquely identify the file. Then you run into the “MyLong~2.dbf” or “MyLong~3.dbf” problem.

I’m looking around to see if I can find a easy way to do that, but you should too.

Thank you for reply. I read this http://www.mrexcel.com/forum/showthread.php?t=355455 post, but i supposed that there is solution more elegant than file renaming.