Reading CSV file with ODBC Text Driver and Retain Field Format

Posted on 2006-04-06
Medium Priority
Last Modified: 2013-12-25
I am using the MS ODBC text driver to read a CSV file.  My logic is fairly dynaminc in that I do not know the number of fields or their format before-hand.  I would like to read the fields in as text fields so the formatting in the csv file is retained.  My problem is that I have a field that is being interpreted as a numeric field and the leading zeroes are being dropped.  For example, '0403100' is being read in as '403100'.   Again, I don't know which field in the table this will be.  I simply want to read the field in as a text field retaining all formatting in the file.  I can not save the CSV file with quotes around the fields either.  Any ideas?
Question by:AddOnsInc
  • 3
LVL 29

Expert Comment

ID: 16393601
You will need to create a schema.ini file and specify column data type as text.


LVL 75

Accepted Solution

Anthony Perkins earned 375 total points
ID: 16394233
If you do not know the format ahead of time, consider opening the file as a standard text file and looping through all the rows.  You can then use the Split funciton to get all the values.
LVL 75

Expert Comment

by:Anthony Perkins
ID: 16540317
Please take the time to re-read the EE Guidelines regarding grading at:
What's the right grade to give?

And in particular this section:
C: Because Experts' reliability are often judged by their grading records, many Experts would like the opportunity to clarify if you have questions about their solutions. If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information; or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. You also have the option here of just asking Community Support to delete the question.
Remember, the Expert helping you today is probably going to be helping you next time you post a question. Give them a fair chance to earn an 'Excellent!' grade and they'll provide you with some amazing support. It's also true that a "C" is the lowest grade you can give, and the Experts know that -- so use it judiciously.

... Similarly, the C grade is the lowest that can be given by a member, a fact which should be kept in mind when grading as well.

The use of a C in a vindictive manner is likely to be changed by a Moderator. You may not like the answer you get, and in some cases, and you may not like the way it is delivered, but if it is deemed to be accurate, no less than a B is an acceptable grade.


Also this link:

Can I get a grade changed?
LVL 75

Expert Comment

by:Anthony Perkins
ID: 16549727
Do you have any comments?

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question