smarks
01-14-2009, 08:29 AM
I never changed the code, but deleted/ recreated a new table and changed some of the datatypes. I'm sure the problem is with the spec file, since the first time I tried coding this, I had trouble and it wasn't until I redid the spec file over & over before it worked (never figured out the error).
Here's the code:
DoCmd.TransferText acImportDelim, "This Spec", "MICROMOLAR", strFolderPath & objF1.Name, False
Any thoughts?
HiTechCoach
01-14-2009, 09:56 AM
You may have not change the code, but you sure changed some of the object is works with, but not all of them to match.
... deleted/ recreated a new table and changed some of the datatypes.
This would render the current "This Spec" invalid. If you make any table design changes, then you will probably need to create a new spec file to match the new table design.
smarks
01-14-2009, 10:23 AM
I did, several times... The kicker is that I can upload text files manually using the same table & spec file, it just doesn't work running the code. Thanks for the reply! Any more advice?
boblarson
01-14-2009, 11:26 AM
I believe you may be suffering from this:
strFolderPath & objF1.Name
Try changing that code to this:
strFolderPath = strFolderPath & objF1.Name
DoCmd.TransferText acImportDelim, "This Spec", "MICROMOLAR", strFolderPath, False
smarks
01-14-2009, 11:32 AM
No dice, same error message 3001 invalid argument. Plus, the code worked previously, it was only after I made changes to the table that it stopped working. I even deleted the table and started from scratch...
smarks
01-15-2009, 08:47 AM
WooHoo! Figured it out: :)
The Access tables must retain memory concerning datatypes. For whatever reason, importing via the DoCmd.TransferText method only works for datatypes = to Number (Long Integer) or Text. Even though importing manually with other datatypes (decimal, memo) works, it will throw the error "Invalid Argument 3001" when running in code.
Once I realized this, I simply changed the datatype and tried running the code -- still received the error! So, I deleted the field, tried reimporting -- still received the error! Thus, there is memory retained in the table regarding datatypes. If I am incorrect with this explanation, please let me know. The only way I was able to make my code function, was to delete my table and recreate it using only text & long integer datatypes.
I hope this helps others in the future!