There are certain aspects of Microsoft Access that can be downright frustrating and puzzling to debug. I want to share a tip with you that will hopefully save you hours of frustration. There is nothing more foundational than importing data into Microsoft Access so most likely you’ll appreciate the fix for this run-time error if you are attempting to use VBA.
If you encounter the following Microsoft Access Error:
“Run-Time error ‘3625’: The text file specification ‘My Saved Access Import Spec’ does not exist. You cannot import, export, or link using that specification.”
Most likely you have confused a saved set of “import steps” with a saved “Import/Export specification” while trying to use the Docmd.TransferText command; or at least I did.
Consider the following sample VBA code that uses the Docmd.TransferText command to import a delimited file (from a path stored in string variable strInputFileName) into a table named “tbl_Access_Import_Data” using an import specification.
Private Sub cmd_Import_Table_Click()
Dim strInputFileName As String
'Set Path to Local CSV File. This file will be imported into an Access Table.
strInputFileName = "C:\Users\Desktop\Access Data\Access_Import_Data"
' Use a Macro to Import a delimited file
' "My Saved Access Import Spec" = Import Spec
' "tbl_Access_Import_Data" = Destination Access Table
' strInputFileName = hardcoded path to source csv file
DoCmd.TransferText acImportDelim, "My Saved Access Import Spec", "tbl_Access_Import_Data", strInputFileName
End Sub
Let me show you where I went off track. I saved “import steps” and then tried to reference the saved “import steps” with the Docmd.TransferText method. You cannot reference “import steps” with this method, only “Import/Export specifications”.
I used the Import Text Wizard to define and delimit the columns in a specified .csv file and indicated the table I desired to have that data imported into. Afterwards, I pressed the finish button.
Once I hit “Finish”, on the very next screen I saved the “import steps” that I previously defined. Notice the verbiage next to step 1 (i.e. “Save import steps”).
As you can see above, I created a saved “import step” erroneously named “My Saved Access Import Spec”. This name was the value that I erroneously passed to the Docmd.TransferText method in code.
These actions result in ‘Run-time error 3625’ that we will fix.
In order to save a legitimate Import/Export specification that can be successfully referenced with the Docmd.TransferText method, make sure to hit the “Advanced” button before you hit “Finish” when you come to the last window of the Import Text Wizard.
Make sure to hit “Save As” (Step 2 above) on the right hand side of the window.
At this point, name and then save your true Import/Export specification name and hit “OK”.
Now when you come to the same window again you can hit the “Specs…” button to observe the names of all of the saved Import/Export specifications.
In the pic above I only have 1 Import/Export specification named “My Real Saved Access Import Spec”.
Observe, once the true Import/Export specification is referenced in VBA code, the code executes as intended.
Additional Tips
I am not aware of how to edit Import/Export specifications. The best advice that I have is to recreate and then overwrite the existing specification or save the new revised specification with a different name.
If you place the following SQL code in a blank Select Query, you can view all the true specification names along with field names and respective field widths.
SELECT
MSysIMEXSpecs.SpecName,
MSysIMEXColumns.FieldName,
MSysIMEXColumns.Start,
MSysIMEXColumns.Width,
MSysIMEXColumns.SkipColumn
FROM MSysIMEXColumns
INNER JOIN MSysIMEXSpecs
ON MSysIMEXColumns.SpecID = MSysIMEXSpecs.SpecID
ORDER BY MSysIMEXSpecs.SpecName,
MSysIMEXColumns.Start,
MSysIMEXColumns.Width;
The results of that query from my example database are shown above. All due credit goes to stackoverflow for this SQL tip.
Furthermore, if you are intent on referencing saved import steps in VBA code (not to be confused with the aforementioned Import/Export specification), then use the Docmd.RunSavedImportExport method.
To execute the “import step” shown in the picture above using VBA, I would use the following command:
DoCmd.RunSavedImportExport "My Saved Access Import Spec"
I hope this helps solve your “how to fix Run-Time error 3625 in Microsoft Access” question. Good luck!
Great and very helpful article!
LikeLike
Glad I could help, thanks for reading!
LikeLike
Helped a user on another forum. Thank you.
LikeLike
Thank You very much! The hint “advanced” was what I was looking for …
LikeLike
Thank You!!!
LikeLike
Thanks. Exactly my problem. The “Save Import Steps” didn’t seem right. I couldn’t see anything better, even though I’d been looking at it in the advanced settings
LikeLike
Glad I could help!
LikeLike
Great article
LikeLike
Regarding editing Import/Export specs, check out the free tool V-Tools from http://www.skrol29.com/us/vtools.php.
Although the website shows the latest as Access 2016, I have it running under Access 2019. Read the instructions on how to install it.
LikeLike
very useful, thanks for saving my time
LikeLike
Very helpful, great help, thanks you very much for sharing solution for this problem
LikeLike
Thanks so much for that. I was perplexed – it seemed so simple. Why they would hide that name baffles me, but that happens.
LikeLike
Thanks Anthony…. great name.
LikeLike
Thank you very much i used it Today to solve my import erro
LikeLike
Glad you found it useful!
LikeLike
Worked perfectkly, thanks
LikeLike
Thank you very much!!
LikeLiked by 1 person
One of the clearest explanations I have *ever* read.
LikeLiked by 1 person
Thanks for the kind words! Glad you found the post useful.
LikeLike
Thanks a lot!
LikeLike
Brilliant. I was just having this problem. Very much appreciated the way you explained it so clearly.
LikeLike
Exactly the mistake I was making. (I knew all this 10 years ago. How much else have I forgotten?)
Thank you very much.
LikeLike
If only all support sites were as accurate and simply explained as this. Thank you so much.
LikeLike
Thank you for taking the time to fully explain the source, and the fix, of the error message and underlying cause.
LikeLike
Awesome! Thank you. That was a real head-scratcher.
LikeLike
Agreed! Thanks for commenting.
LikeLike
Works perfectly … thanks a lot
LikeLike