Transfertext method

Asked

Viewed 500 times

3

I am trying to implement the VBA so that once finished feeding my table, it is exported to a TXT separated by ";"

The name of my table is table. I saved my Export specification as "Especexport" and configured so that the fields are separated by ";" and the decimal separator is "," and the text delimiter is double quote (")

And in VBA, I put the following code:

Function Exportar_TXT()
        Dim nPath As String

        Let nPath = "C:\txt\"

        DoCmd.TransferText acExportDelim, EspecExport, "tabela", nPath & "tabela.txt", True


    End Function

But the following mistake is making:

"Runtime Error '3441': The text file specification field separator matches the decimal separator or text delimiter."

How to fix this?

My Access is 2013.

1 answer

0

This is because the language of the operating system is working with a different character map. As the language configured is English or other than English (I assume) the comma is used as a decimal separator.

To fix you can try:

  1. Change your operating system language to English.

or

  1. Tell the type of encoding you are using when exporting:

    Docmd. Transfertext acExportDelim, Chr (& H3B), "table", nPath & "table.txt", False

"H3B" being the semicolon obtained through the character map as seen in the image below (in my case U+003B):

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.