Martin Dreher Martin Dreher - 9 months ago 44
SQL Question

Error when SQL-querying flatfiles with custom file-extenstion

I'm looking for a way to query flatfiles with custom file-extensions directly via SQL.

Normally use something like

SELECT * FROM [Text;DATABASE=C:\Flatfiles].[S7121070_ppis#csv]

which works terrific with .txt, .csv and .tab.

However, in my current project I work with fixed-width flatfiles with an .ftp7-extension. When querying those files in with VBA, I encounter Err# -2147217911, stating that the object or database is locked.

Oddly, this occurs only whenever I querying anything that's not a .txt, .csv or .tab. Meaning
can't be queried.

Can't this be done or am I simply missing something? Thanks for your help!

Additional Info:

  • I use either Excel or Access with VBA

  • Renaming .ftp7 to .csv, .txt, .tab solves the problem, but is a no-no due to read-only access

  • I can use a
    -files to describe the data-structure, so i would have expected that the actual file-extension is more or less redundant for interpreting the files contents

Answer Source

As postet by Fionnuala: Editing the registry seems to solve the problem.