Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Link to text file (A97)

    Working with some datalogging equipment that generates an output text file. My task is to import the text file into Access 97. I have worked with a fake output file (DELREAD.txt) and successfully linked the file and created an import specficiation. So far, so good. Next step is to create a copy of the textfile (Copy of DELREAD.txt) and to link to it. Works successfully.

    Next step is to try to link to an identical textfile, but with a different name (DELREAD.DAT) that conforms to the naming convention used by the datalogging hardware. When I try to link to that file using exactly the same steps and specification as with the previous copy, Access responds with an error message. Tried the same thing with VBA code, and received Error Number 3027 - "Object is Read-Only". Here is the VBA code that generates Error 3027 -- changing the filename to DELREAD.txt works successfully.

    Private Sub Command0_Click()
    DoCmd.TransferText acLinkDelim, "DELREAD Link Specification", "zztest", "EELREAD.dat"
    End Sub


    Is there a way to read the .DAT file? Other than using Windows to change the filename after it is created from the datalogger, I don't have any control over the textfile name. This process eventually needs to be done using VBA code behind a form. Thanks.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

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

    Re: Link to text file (A97)

    Access can only work with extensions .txt, .csv, .tab and .asc for text files. All other extensions cause the error you report. You can rename files from within Access, for example:

    Name "EELREAD.dat" As "EELREAD.txt"

    or if you'd rather make a copy:

    FileCopy "EELREAD.dat", "EELREAD.txt"

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Link to text file (A97)

    Easy solution!! Thanks.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

Posting Permissions

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