Link to home
Create AccountLog in
Avatar of SteveUr
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 !!
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of SteveUr
SteveUr

ASKER

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
a solution was provided