CSV import and NoName column is being added (1 Viewer)

DevAccess

Registered User.
Local time
Yesterday, 20:22
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:22
Joined
May 7, 2009
Messages
19,247
Open the csv on excel.
Goto the first blank column and delete the column and save
 

DevAccess

Registered User.
Local time
Yesterday, 20:22
Joined
Jun 27, 2016
Messages
321
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:22
Joined
Sep 21, 2011
Messages
14,336
Show the first two lines of the csv.
I'd expect there to be a ,, in it at the end?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:22
Joined
May 7, 2009
Messages
19,247
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

Top Bottom