I want to export to a text file from an Excel or Access macro. I need to look to see if that file name already exists, and if it does, append data to the end of that file, otherwise just write the file.
Access's built-in facilities don't allow you to append data to a text file. Any of these approaches will do it: A) export your second file in the normal way and then concatenate it to the existing file (using Dir() to check whether it exists, and Shell() to call the Windows COPY command to do the actual concatenation. B) temporarily import the existing file into an Access table, append the new data, and export it all to a new text file. C) open a recordset on the data you want to export, open the existing file using the VBA Open ... For Append ... statement, and use VBA code to write the new data line by line. "aimwhy" wrote in message news:202A02B2-9C4D-4746-A238-8384796959EA@microsoft.com... >I want to export to a text file from an Excel or Access macro. > I need to look to see if that file name already exists, and if it does, > append data to the end of that file, otherwise just write the file. >