Search code examples
ms-accessvb6daojet

Jet error 3011 when opening a file with 2 "extensions"


I'm having a problem with Jet throwing error 3011 when I try to use it to open a file with 2 "extensions" ("filename.tst.csv").

Run-time error '3011'

The Microsoft Jet database engine could not find the object 'filename.tst.csv'. Make sure the object exists and that you spell its name and the path name correctly.

Where the code looks like this:

Dim db as Database, rs as Recordset
Set db = OpenDatabase("SELECT TOP 1 * FROM [" & fileName & "];")
Set rs = db.OpenRecordset("SELECT TOP 1 * FROM [" & fileName & "];")

I've tracked down the problem to be the second extension (or apparent extension) ".tst" but I'm not sure why the error is occurring and I haven't been able to find an answer through Google or through here - but I figure someone might have some insight as to the limitations.

This is using DAO 3.6 in VB6.


Solution

  • This isn't exactly the situation you're talking about, but in reading this, in the CAUSE section, the information about some drivers not supporting long filenames looks like it would apply, since this is not in an 8.3 format.

    http://social.technet.microsoft.com/Search/en-US?query=3011&ac=8

    So, you'd need to rename the file OR use another method to load the data (such as using a StreamReader). Personally, I'd rename the file. It'd be much easier.