Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88868

DoCmd.TransferText issue with delimiter and decimal

$
0
0

I have the following issue:

I'm trying to import a csv-file with:

Dim appAccess As Access.Application
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase (databasePath)
appAccess.DoCmd.TransferText transferType:=acImportDelim, tableName:=dbTableName, Filename:=strPath, hasFieldNames:=True

I'm using a German machine, where the standard delimiter is ; and the standard decimal-separator is ,. If I use those separators however, I get an error (the data didn't get separated correctly). If I change the separator in the csv-file to ,and the decimal-separator to ., the data gets loaded in the database, but the . is ignored and numeric values therefore aren't imported correctly.

I don't have the option, to create an import scheme in access manually. Is there a way, to do this with vba?

EDIT

I have created an Schema.ini-File, which looks like this:

[tempfile.csv]
Format=Delimited(;)
ColNameHeader=True
DecimalSymbol=","

And saved it in the same folder where the csv-file is located.

But I still get an Runtime-Error, saying that field1;field2;... is not an header in the target table. So I'm guessing, the method didn't use ; as a delimiter.


Viewing all articles
Browse latest Browse all 88868

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>