Problem Using Macro to Import TXT file

WallyTee

New member
Local time
Today, 10:43
Joined
Mar 24, 2012
Messages
9
I want to use a macro to import data from a comma-delimited text file and append its data to an existing table. I have created an 'Import Specification' in the Import Wizard and entered it as required into the macro design view --- along with the source data filename, table name, etc.

Problem occurs when I try to run the macro. It won't run and I get an error message (2590) that says the Import Specification "doesn't exist." I have double checked all spelling and case, but nothing seems to work. I suspect the problem may somehow be related to security and 'trust' settings, but I don't see anything obviously wrong.

Any ideas, suggestions or comments will be greatly appreciated. WallyTee
 
The problem could be in "Windows " itself with the security settings
I have had a similar problem before

Go to : Control Panel /Action center /Change user Accounts Control settings and pull the slider down to the the bottom "Never Notify"

Hope that helps
Captn K
 
Last edited:
Capt K: Thank you so much. I will give it a try and let you know. WallyTee
 
Hi again CptnK ---- I tried your suggestion. Unfortunately it didn't work. I am Sooooooo frustrated. I have double-checked EVERYTHING. I know the specification exists, I have checked and removed all security restrictions, made sure the database is in a "Trusted" folder, etc. But every time I try to run the macro, the system tells me, "Specification does not exist." Yikes.

Anyway, now that I've vented, I'd like to thank you again for your effort and thought. If you can think of anything else I can try, please let me know. WallyTee
 
Its a couple of years since I moved from Office 2007 to 2010,but I know when I did running some text import Macros that I had used since office 2003 became problematic in Access 2010.
There are a number of articles on the net with problems running some macros in Access2010.
In the end I moved the Macros to VB code and then executed it (from a button).
Just as a note of caution U may need to attach VB to access if the VB icon is not already showing up in Access
.
U could perhaps try something like this.
(I have had to edit it and shorten it as my text import procedure is quite extensive ,but this should give u the general idea.)
Yes its a pain when they dont work
Anyway try something along this line
"Private Sub Command44_Click()


'*******************IMPORT******************
'Turn off the warnings (or they will drive you bonkers):
DoCmd.SetWarnings False
'set up variables:

'check if there is anything to do:
While Dir("d:\"FolderName"\Downloads\*.txt") <> ""


'get the name of the first file:
filename = Dir("d:\FolderName\Downloads\*.txt"

'append the records from Downloads to "TableName":

DoCmd.TransferText acImportDelim, "", "Tablename", "d:\"FolderName\downloads\" & filename, False, ""

'move the file we have just imported out of the way(so we don't import it again)
Name "d:\FolderName\Downloads\" & filename As "d:\FolderName\Downloads\Datadone\" & filename
'make sure that operation is finished before continuing:

'loop back if there is another file:
Wend
End Sub
 
Hi again [FONT=&quot]captnk---- Thanks again for your concern and help. I am not familiar with VB but I am definitely going to start learning. However, I did finally get a macro to work the way I want it. The solution turned out to be very simple although it took me about ten hours to figure it out. The solution was to NOT use the macro action 'ImportExportText' but to use 'RunSavedImports' (after having run the Import Wizard one time and saved the settings. Amazing, but very gratifying after I figured it out. BTW, I am not an advanced user or a programmer. I'm just an old geezer tying to do some not-too-complicated jobs with Access --- which I happen to really like. Thanks again Cap'n. WallyTee
[/FONT]
 

Users who are viewing this thread

Back
Top Bottom