Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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 ", _
    "REF 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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error 31519 - Cannot Import file (WIN XP/Access 2003)

    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.

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error 31519 - Cannot Import file (WIN XP/Access 2003)

    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. <img src=/S/confused3.gif border=0 alt=confused3 width=45 height=45>


    Michael

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error 31519 - Cannot Import file (WIN XP/Access 2003)

    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.

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error 31519 - Cannot Import file (WIN XP/Access 2003)

    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

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error 31519 - Cannot Import file (WIN XP/Access 2003)

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •