• Error 31519 – Cannot Import file (WIN XP/Access 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Error 31519 – Cannot Import file (WIN XP/Access 2003)

    Author
    Topic
    #432197

    I love Access and I hate Access. Just when I think I have a handle on it, it does something else.

    I converted a db from 97 to 2003 – I have code behind a button on a form that imports a data file using import specs.

    On some of my databases everything works fine. On others I get the error 31519 – you cannot import this file.
    Looking at MSKB, I couldn’t find an article on this particular error, but googling around, it seems it is supposedly due
    to lack of file extension .txt (A97 imported these files fine)

    I would have thought that if it couldn’t import the file into one database, it shouldn’t be able to be imported into any
    database.

    To clarify: I have the same database copied 3 times (one for each client) and use the same code for import.

    There are actually 3 different files – one for each client.
    The names of the file that works:
    G0005V00 (No extension)
    In A97 they imported no problem. In ONE of the 3 databases. it imports fine. In the other 2, I get the error.

    Here is the import code for the one that works:

    DoCmd.TransferText acImportFixed, “CAP 2005”, “CAP ABC “, _
    “R:DEF HMOs 2006XYZ 2006JUN 2006CAP FILESABCG0005V00”, False, “”

    Here is the import code for the ones that don’t work (same code, different client!):
    File name = G0006V00 (no extension)

    DoCmd.TransferText acImportFixed, “CAP 2005”, “CAP DEF “, _
    “R:ABC HMOs 2006XYZ 2006JUN 2006CAP FILESDEFG0006V00”, False, “”

    Based on the MSKB article, it is because there is no “.txt” extension. But my (sometimes illogical) logic
    says, that if it was due to the lack of a file extension txt then NONE of the files could be imported.

    So I am not sure where I should be looking. Is it the files themselves that are creating the issue?
    Apparently the import specs, the import code and the lack of a txt extension is not what is causing the error.

    Any suggestions where to look? It is quite confusing !

    Thank you.

    Michael

    Viewing 0 reply threads
    Author
    Replies
    • #1013410

      As far as I know, Access has never been able to import text files without extension. Do you happen to hide the extensions of known file types? This is a setting in the View tab of Tools | Folder Options in Windows Explorer. If you do hide them, change the setting by clearing the check box. Now check whether the files still don’t have an extension.

      • #1013418

        Hello Hans. The file extensions are not hidden. I have always imported these files in A 97 with no issue at all.

        The confusing part here is that the file imports fine into one database, but a file from the same company
        won’t import into an identical database with identical specs, code etc.
        I know you can’t manually import a file without the txt extension using the Import Wizard, but using fixed width specs
        I can import the ‘extensionless’ files in code.

        I just can’t figure it out. confused3

        Michael

        • #1013422

          Strange – I cannot import text files without extension either manually or in code, and I have never been able to do so in previous versions of Access. As far as I know, that is the way it is designed.

          But the workaround is easy – just give the files an extension .txt, .asc, .csv or .dat.

          • #1013428

            What we do is obtain the fixed width specs from the client.
            Then I take their file and add the txt extension.

            Then I manually import the file using the Import Wizard and create the Import Specs.

            Once the file is imported and I save the specs, I can then import the file without the
            extension using the above code and spec.

            Michael

            • #1013430

              As I said, that doesn’t work for me, and it never has.

    Viewing 0 reply threads
    Reply To: Error 31519 – Cannot Import file (WIN XP/Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: