CSV import and NoName column is being added

DevAccess

Registered User.
Local time
Today, 13:26
Joined
Jun 27, 2016
Messages
321
hello

I am using below code to do csv import

DoCmd.TransferText acImportDelim, tableName:="tbl_Basic", _
FileName:="C:\Download" & "CS" & getMonth & "" & CStr(getYear) & "\PILOT_BASIC.csv", HasFieldNames:=True

itdoes works well but also adds one extra column in table tbl_Basic at the end called NoName, while there is such column in CSV file.

Please advise.
 
Open the csv on excel.
Goto the first blank column and delete the column and save
 
Open the csv on excel.
Goto the first blank column and delete the column and save

But I can not go everytime and modify csv file because it is automated process, the files are being saved from PowerShell and unziped in it.

and they are being used in Access.

Thanks
 
Show the first two lines of the csv.
I'd expect there to be a ,, in it at the end?
 
after importing the csv to tbl_PilotBasic add this line
to remove the NoName column:

On error resume next
currentdb.execute "Alter Table tbl_PilotBasic Drop Column NoName;"
 

Users who are viewing this thread

Back
Top Bottom