0

I am looking for a way to export a query or table to a text file in Microsoft Access programmatically. That is not using the export wizard. I found examples from other databases (ref below), but when I run the sql code in ms access ... select * into outfile 'c:/histdata/outfile.txt' from mytable ... ms access gives an error "query input must contain at least one table or query" (This is error 3067 in access 2016).

Thanks in advance.

ref: https://mariadb.com/kb/en/select-into-outfile/

quinn
  • 177
  • 1
  • 2
  • 13
  • Not valid SQL for Access. Have you looked at DoCmd.TransferText method? Otherwise read/write text file. – June7 Jun 29 '20 at 20:28
  • Does this answer your question? [Exporting a query result into a text file using vba-MS Access](https://stackoverflow.com/questions/17272945/exporting-a-query-result-into-a-text-file-using-vba-ms-access) – June7 Jun 29 '20 at 20:38
  • no it does not because I"m specifically looking at the "select * into outfile" way of doing it. VBA is rather cumbersome reading each line from the recordset in the query and writing it out to a file. (query is large). – quinn Jun 29 '20 at 21:03
  • AFAIK, that SQL is not valid in Access and will have to use another method. – June7 Jun 29 '20 at 21:13

0 Answers0