[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 655
  • Last Modified:

Invalid Argument Error When Running docmd.transfertext Twice

When I run the following code... either in a row or in 2 different spots in the code I get an "Error Invalid Argument" when trying to execute the second docmd.transfertext.

Is there a a way to take the same data and import it into 2 different tables at the same time... or after importing copy the data from one table to the other?
DoCmd.TransferText acImportDelim, "Grps Import Specification", "Grps", "C:\Grps_" & Yr & Mth & Dy & ".txt"
DoCmd.TransferText acImportDelim, "Grps Import Specification", "NewGrps", "C:\Grps_" & Yr & Mth & Dy & ".txt"

Open in new window

1 Solution
You can create an append query that appends all records from Grps to NewGrps, probably quicker than teh import also. If you create the query through the QBE then drag each field from Grps down and it should match top the fields in NewGrps. Below is the basic SQL Statement required

INSERT INTO NewGrps (Field1,Field2)
SELECT Field1,Field2 FROM Grps

Cheers, Andrew

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now