Type Conversion Failure on Import from CSV

When importing a CSV file into Access, I received a type conversion error on a number field with 10digits. Access assigned Long Integer to the field but the data did not import. I read here
that going to the Advanced tab and changing the Code Page from OEM United States to Western European (Windows) would solve the problem and it did. Does anyone understand why?
DavisroBudget AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
At a guess, it changes the way the Wizard identifies the field type.

 Access makes an educated guess as to the field type based on a sampling of the first few rows.  Sometimes it guess wrong.   A common one is on US postal codes, which are 5 digits.  But the US also has zip + 4, so some data will look like this:


 with a dash, meaning you need to import it as a text field.   You also loose a leading zero if it imports it as a number.

 What and why the code page adjustment triggers a change though I have no idea.

  The real fix of course is to adjust the field types.

DavisroBudget AnalystAuthor Commented:
Hi Jim. Sure, but the field type seems correct. The 10 digit numbers in Excel are formatted as General. When I pasted them into notepad (multiple excel files totaling 600k records), and then imported the file, Access assigned Long Integer to the field which seemed appropriate, yet, the data then failed to import
Fabrice LambertConsultingCommented:

Within the Import wizard, you can define the data type for each column.
Choose either Double, or Text data type (whatever fit your needs).
Price Your IT Services for Profit

Managed service contracts are great - when they're making you money. Yes, you’re getting paid monthly, but is it actually profitable? Learn to calculate your hourly overhead burden so you can master your IT services pricing strategy.

Fabrice LambertConsultingCommented:
but the field type seems correct. The 10 digit numbers in Excel are formatted as General.
Beware that Excel and Access don't handle data type the same way. Access is less tolerant.
DavisroBudget AnalystAuthor Commented:
Fabrice, Alright...so what would be the appropriate data type for a 10 digit number? I'm sure text would work but I don't understand why Long Integer doesn't work
Fabrice LambertConsultingCommented:
Long Integer data types are 32 bits and range from -2147483648 to 2147483647, so not all 10 digits numbers will fit in.

If you need to keep a numeric value, Double type, else Text type.
Mark EdwardsChief Technology OfficerCommented:
For the simple reason of the defined range for a Long Integer (copied from Microsoft support website page):
"Long Integer — For integers that range from -2,147,483,648 to +2,147,483,647"
a 10-digit number can go higher.
for .CSV import, you need to setup an import specification.  You need one for .CSV export.
Also, the Import Specification details recorded in the "MSysIMEXSpecs" table (has specification name) and its child table "MSysIMEXColumns" (field details) are much more than what are exposed to you by the wizard.  You can edit the data in this table to any data type for any column you want.  I built my own specification editor form so I could get full exposure to, and editing capability of, import/export specifications.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mark EdwardsChief Technology OfficerCommented:
O.k.  sorry, you don't NEED to set up an import specification for CSV, but it avoids/fixes these kinds of issues.
DavisroBudget AnalystAuthor Commented:
Of course. So Double or Decimal would work. Thanks for pointing this out.
Mark EdwardsChief Technology OfficerCommented:
Also, if you use VBA to Import .CSV with the TransferText function, you'll need an import specification for that....
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.