Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access/VBA: Unparsable Record when exporting into text with Schema.ini

Status
Not open for further replies.

LegalizeTheTruth

Programmer
Jan 20, 2011
4
DE
Hey all,

I've got a problem which is driving me crazy now. I'm trying to export a table into a txt with the help of the Schema.ini file. I'm using the following code in this file (which I've placed into the folder where I'm exporting to):

[Mytable.txt]
ColNameHeader=True
Format=TabDelimited
MaxScanRows=0
CharacterSet=OEM
NumberDigits=3
DecimalSymbol=.
TextDelimiter="none"

The vba line for the export is this:

DoCmd.TransferText acExportDelim, , "Mytable", dbPath & "exported\Mytable.txt"

There are 3 columns only, since I wanted to test this thing. These are:

Name (Text)
Age (Long Integer)
SomeNumber (Double)

When I'm runing the export code the result is the following:

Name Age SomeNumber
"Steven",27,3,00

So only the header is changing into the right format and the settings are not effecting the records. I'm also getting ExportErrors (obviously) telling that there are Unparsable Record for all the record lines (now it's just 1, but if I fill it with more, the same thing happens for those records too).
I've searched the net for a solution but could not find any... all the people who are using schema.ini they want to import the text file. Maybe there is a simple solution I'm not aware of, but I hope someone can help with this problem.
Sorry if I left out something, I'm not a big forum user...
Bless
 


How is MyTable structured?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
It's there, but sorry, I was not clear enough with this.
So it has 3 fields, and the FieldNames (Types) are:

Name (Text)
Age (Long Integer)
SomeNumber (Double)

Only 1 record in this table:
Steven
27
3

Or have I misunderstood something?
This table is just for testing, so I can check the output easier..
 
You have to do the export one time manually, saving the SpecificationName and then use it as the 2nd argument of the TransferText method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yeah, I know this option too. I was using it like this until a bumped into another problem. The thing is that you can not export more than 2 decimal places into a text file. This is the main problem. Access use the Regional settings from windows. The database I'm working with will be used by a bunch of other computers.
There were other solutions like converting these DOUBLE fields into TEXT so it remains eg. 3 decimals, or make a query and format these fields with format(fieldName;"0,000") and export this query...
I thought it would be the best to use the Schema.ini to set the export options, but it don't want to work as it used to.
I also have to have the option to change the delimiter (comma or dot) but this way I have to make 2 Export Specifications / table (I have lots of tables :) ). So my problem is not to find a way around, but to be able to work with the Schema and why I can not make this work.

Thanks the tip though PHV...
 
My preferred way is the formatting query ....

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 



I believe that if you use the Schema.ini file, you must use the ODBC Text driver via ADO, for instance.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top