Avatar of SteveUr
 asked on

Access - import specifications

I wish to call using, transfertext in vba, an import from csv file to a table.

This works fine by hand and,  when saved, works fine from the save.
BUT I can find no way of finding out the name of the import specfications to be used  in the statement where I have at present "import-INVFROM SAGE" which is the name in the saved Exports

DoCmd.TransferText transferType:=acImportDelim, SpecificationName:="import-INVFROM SAGE", TableName:="topinvnum", FileName:="C:\!!!!SAGE\2017hire_to_sage\transfersfromsage\INVFROM SAGE.cs", hasfieldnames:=True

Nothing   seems to work but there seems to be no way to find out the specification name.
This CANNOT be this hard - so please someone tell me where I am being stupid !!
* importingVBA

Avatar of undefined
Last Comment
Rey Obrero (Capricorn1)

8/22/2022 - Mon
Rey Obrero (Capricorn1)

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.

Thaks for that speedy reply.  The problem was a little more complicated - I had done - many, many times exactly as you suggested   I have saved import which works fine by hand
 called " Import-INVFROMSAGE"
But the MSysIMEXcolumns didnt match  - little bit pasted to illustrate .
The ANCILLARY.... is an old spec which worked but was deleted ages ago
 But I did it again whenI got a clue that a blank  I had in ( deliberately) the file name seems to screw things up - I noticed that the .csv file became #csv in the error message
So there we are - it works and is now in the MSysIMEX list -
FileType      SpecID      SpecName      SpecType
0      1            0
0      3      1      0
850      13      ANCILLARY-GET_TOPNUM-INVOICE Import Specification      1
850      18      INVFROMSAGE      1

cant get rid an old one Ancillary... still !!!!
Meanwhile I had cheated and just did a TransferType:=acLinkDelim and worked from there

Thanks again though working step by step through helped

So I think BEWARE of anything but absolutely standard old fashioned file naming! Blanks appear to be  a NoNo
Rey Obrero (Capricorn1)

a solution was provided
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck