Import a .txt file into access - With specs

ofafa72
ofafa72 used Ask the Experts™
on
My Text file name is: stjservx_APRIL07.txt
My access tableName is : ServiceAnalysis_TempHolder
My specs table name is: MSysIMEXSpecs

I want a macro that will import the text file into Access. In this process, I do not want to exclude my specs in my process. Please help.

is this the same process if I want to export to .txt file If I have specs too.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:

you can use

dim txtFile as string
txtFile= "C:\stjservx_APRIL07.txt"

DoCmd.TransferText acImportDelim, "MSysIMEXSpecs", "ServiceAnalysis_TempHolder", txtFile, True, ""
Top Expert 2016
Commented:
MSysIMEXSpecs is the name of the table that holds all the specifications

find the specification name that you want to use and use it on this line


dim txtFile as string
txtFile= "C:\stjservx_APRIL07.txt"

DoCmd.TransferText acImportDelim, "YourSpecName", "ServiceAnalysis_TempHolder", txtFile, True, ""

Author

Commented:
I get a runtime error 3625
"The text file MSysIMEXSpecs deos not exist you can not import, export or link using the specification"

I have always had trouble with import export, please help
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Never mind. Error on my part. I was using the wrong SpecTableName.
Thanx for you help

Author

Commented:
Using the same filename, what would be the reverse (Export to text)
Top Expert 2016
Commented:
DoCmd.TransferText acExportDelim, "Specname", "TableName", "C:\Mytext.txt", True

Author

Commented:
Thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial