Importing CSV via wizard to Access table (1 Viewer)

jaryszek

Registered User.
Local time
Today, 02:40
Joined
Aug 25, 2016
Messages
756
Hi,

i am getting error while importing data from CSV:

The first row contains some data that can't be used for valid Access field names

Why is that?
I checked field Names and they are divided with double qoutes and Names are correct. Without any "_" or other special signs.

Can anybody help?
Jacek
 

isladogs

MVP / VIP
Local time
Today, 09:40
Joined
Jan 14, 2017
Messages
18,186
Often CSV files will include empty columns that Access tries and fails to import. If so that error occurs.
You can instruct the wizard to skip unwanted columns.
Also, check whether the import includes all the required columns
 

vba_php

Forum Troll
Local time
Today, 04:40
Joined
Oct 6, 2019
Messages
2,884
they are divided with double qoutes
what do they look like in excel? for instance, are the values like:

header1 header2 header3

or is it like:

"header1" "header2" "header3"

??? it's not a big deal if u have to change the field names upon import anyway, is it?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:40
Joined
Oct 29, 2018
Messages
21,358
Hi Jacek. After you get the error, does the import continue? If so, I think Access will replace the invalid field names. If so, you should be able to tell which columns Access was complaining about and examine them more closely. For example, see if they contain non-printable characters.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:40
Joined
Feb 19, 2002
Messages
42,981
Can you open the file with notepad and copy and paste the header line here?

Access doesn't like names that start with spaces. These are sometimes hard to see since we use proportional fonts so spaces become very small.
 

isladogs

MVP / VIP
Local time
Today, 09:40
Joined
Jan 14, 2017
Messages
18,186
Jacek
The screenshot below illustrates what I was referring to in post 2.



The csv file includes an empty 'field' triggered because I clicked in column D (deliberately in this case).
This confuses the import wizard causing the error you described and results in import errors as shown in the resulting Access table

Can you work out why the import wizard 'invented' the £3.00 value - it was 'trying to be helpful'

The solution in this case is to instruct the wizard to skip the unwanted Field4 in the import.
 

Attachments

  • Capture.PNG
    Capture.PNG
    39 KB · Views: 153
Last edited:

jaryszek

Registered User.
Local time
Today, 02:40
Joined
Aug 25, 2016
Messages
756
Hi Guys!!

Sorry for my late answer.

Thank you very much for your explanations and help!
I tried once again. Colin explanation helped the most.

Best Wishes,
Jacek
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:40
Joined
Oct 29, 2018
Messages
21,358
Hi Jacek. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom