[AccessD] Query a text file without attach or import

Gustav Brock gustav at cactus.dk
Thu Oct 14 12:02:08 CDT 2004


Hi all

Should you ever need it, you can query a text file directly without
importing or attaching it first. The trich is to understand that
Access regards the directory of the text file as a "database":

  SELECT
    [pics#txt].Field1,
    [pics#txt].Field2
  FROM
    [pics#txt] IN '' [Text;DATABASE=c:\windows\temp;];

or:

  SELECT
    Field1,
    Field2
  FROM
    [Text;DATABASE=c:\windows\temp;HDR=YES].[pics.txt];


I should note that - as to my testings - even if you specify HDR=NO,
Access still reads the first line for the column names.

These syntax are very handy when you need to read temporary text files
where you do not wish to attach these at all.

/gustav




More information about the AccessD mailing list