Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Aug 2001
    Location
    Cleveland, Ohio, Ohio, USA
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TransferText - 2003 (Windows XP )

    Good Morning,

    Using Windows 98 and Access 2000, I had created a VBA routine to Import 2 text files. The text files are fixed length and had an extension of .WRK. It worked just fine. The people using the Access program have changed to Windows XP and Office 2003 and now the VBA will not work. I get an error message "Can not Import this file". If I change the extension to a .ASC, .TXT , etc, the file will import without problems. Is Office 2003 that much different from 2000? I'm trying to automate the import so the users will have the lest amount of work. Below is the complete Import routine;

    Private Sub ImportFile_Click()

    DoCmd.RunMacro "Delete 440 441 tables"
    DoCmd.TransferText acImportFixed, "440 import specification", 440, "d:zergottpostal440.wrk"
    DoCmd.TransferText acImportFixed, "441 import specification", 441, "d:zergottpostal441.wrk"
    DoCmd.RunMacro "Delete Errors"
    MakeNewCR_Tbl_Click

    End Sub

    I have not found a solution to use the current command line or to find a VBA command that would allow me to change the extension. Would someone please Help.

    Thank You for your assistance

    JimH

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: TransferText - 2003 (Windows XP )

    If the actual files you want to import are OK, and the problem is just with the name of the file you can use the Name command to rename them.

    Name "d:zergottpostal440.wrk" as "d:zergottpostal440.txt"
    Name "d:zergottpostal441.wrk" as "d:zergottpostal441.txt"

    Another possibility is to use the FileCopy command which will copy a file and give it a new name.
    Regards
    John



  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: TransferText - 2003 (Windows XP )

    It isn't Access per se that changed, it was the extensions that are recognized as text files that changed. There are registry hacks to get around this, but the simplest method is to make sure the files have a txt extension so that Windows and Access know what they're dealing with.
    Charlotte

  4. #4
    Star Lounger
    Join Date
    Aug 2001
    Location
    Cleveland, Ohio, Ohio, USA
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TransferText - 2003 (Windows XP )

    John,
    Thank you for your reply. The Name command worked perfectly.

    Jim

Posting Permissions

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