473,396 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Why are leading zeros dropped on a import to Access 2007 from a .csv file?

I am working in Access 2007 and trying to import a .csv file. One of the fields in the .csv file, called Locations, contains numbers with leading zeros and also the last record contains letters. I am importing into a predefined table and the field Locations is set up with Text formatting. When I import my file, the leading zeros are lost and the last record that contains letters is not loaded. The error I receive is “Type Conversion”.
I would greatly appreciate any help, I am lost and don’t know what to try next.
Thanks in advance.
Jennifer
Sep 27 '10 #1
6 7946
Mariostg
332 100+
You might want to double check the field type of the database. It really looks like the problematic field is of numeric type. That woud be why the leading zeros are dropped and the the text record is rejected because it tries to place text in a numeric field.
Sep 27 '10 #2
MMcCarthy
14,534 Expert Mod 8TB
Also I assume you are linking the csv table to your database. Check what datatypes access is imposing on the csv linked table.

One thing you could try is to change the .csv extension to .txt

It might help
Sep 27 '10 #3
Hello MMcCarthy,
It is definately a text field format (see attached file, field Loc) that is why I find this so frustrating. I have read on a few other posts that Access looks at the first few records in a load to determine the field type and this seems to be exactly what Access is doing here. The solution written on the other post was to predefine a table with the formats I desire. I have the predefined table and still it is not working. I will try changing the load file to a .txt extension. I am manually loading the file. Once I get this to work I will automate it but I am still in the testing phase. Any other suggestions? I really appreciate it.
Jennifer
Attached Files
File Type: zip Doc1.zip (145.7 KB, 143 views)
Sep 27 '10 #4
MMcCarthy
14,534 Expert Mod 8TB
If you are doing a manual import click on advanced and expand the field list to show data type. You should be able to change the data type there.
Sep 27 '10 #5
The advanced button only gives two columns, field name and skip. If I choose to import to a new table then the advanced button will show other options such as field type. Am I missing something? Is there a way to have the field type appear when importing to an existing table? I can then save my options as a specification for future uploads.

I did change the load file from .csv to .txt and amazingly it worked! I am very grateful to you for this recommendation. Just out of curiosity any idea why the .txt file works? I thought .csv and .txt were basically the same?
Thanks for your help.
Jennifer
Sep 28 '10 #6
MMcCarthy
14,534 Expert Mod 8TB
.csv files are managed by Excel and excel rules get imposed which doesn't seem to happen with .txt files. The wonders of Microsoft :)

Regarding the issue of the Advanced Button. The other fields are actually there. If you double click in the join between field name and skip they should expand. If I remember correctly it will expand by one field for each double click.
Sep 28 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Clint Stowers | last post by:
Using A2k Exporting a query to a CSV file. The problem is any text fields (i.e. 000345) lose any leading zeros. Exporting to an excel file this problem does not exist. Tried to create a...
3
by: ineedahelp | last post by:
Can anyone help me...I am trying to output my access report to excel. One of my fields is formatted as text, but excel is dropping leading zeros...only on the records where all values are numeric. ...
2
by: thepisu | last post by:
Does anyone knows the odbc driver / string to connect to Access 2007 file (.accdb)? I can't find it anywhere...
4
by: =?Utf-8?B?U3RldmVU?= | last post by:
I am trying to write an application using VS 2005 that accesses an Access database. Unfortunately, VS 2005 doesn't seem to understand the new Access 2007 file extention. Can VS 2005 use the new...
5
by: Rocky | last post by:
My Access 2007 file fails to open on a machine with the 2007 Access runtime version installed. It comes up with a Security alert message. Is there a security setting in the Access Database that...
6
by: JimmyKoolPantz | last post by:
Task: Customer wants a script of the data that was processed in a "CSV" file. Problem: Zip-Code leading zeros are dropped Basically we have a client that has requested a custom script for...
5
by: ISUTri | last post by:
We are currently converting from Access 2003 to Access 2007. I have an Access app that is going to be very difficult to convert. This App is used by people that are out in the field and are a...
0
by: myemail.an | last post by:
Hi all, I had a database with 3 tables (no queries) in an Access 2007 file. I converted the file to Access 2000 format, as that is the only Access format recognized by the SQL server we have...
0
by: MBlock316 | last post by:
Hello everyone, I am trying to import a Microsoft Excel 2007 formatted file into my application. I found on another thread in another forum that I needed to install the 2007 Office System Driver:...
4
by: davjoh123 | last post by:
I have saved an import and it works great. I would like to be able to start the saved import from a button on a switchboard. I tried using TransferText and the saved import name but it does not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.