none
Can MS Access link a PRN file? RRS feed

  • Question

  • My company has a software package that outputs .PRN file extensions for data readouts. There is no option to output to .TXT, but if I copy the file and change the extension to .TXT, the external data wizard links and recognizes the data inside perfectly. I want to use MS Access (Office 365 ProPlus license) to link to these .PRN files the exact same way that it connects to a .TXT file without changing the file extension. Asking the users that produce/update the .PRN files in question to copy/change/update the files is a non-starter.
    Is there a method (Custom ODBC, Registry hack, Wizard trick, etc.) that will allow the "Get External Data - Text File" Wizard (External Data -> New Data Source -> From File -> Text File) OR a similar function to establish link to .PRN files?
    Wednesday, January 22, 2020 2:27 PM

All replies

  • Usually a .PRN is a simple text file..so probably you could open it with either a Text Editor or VBA....make the changes and save it as .txt.....problem resolved.
    Thursday, January 23, 2020 12:01 PM
  • All you need is to rename the file before linking it:

    Name "d:\folder\OutputFile.PRN" As "d:\folder\OutputFile.txt"
    or copy it from the source folder to a folder holding linked files:
    FileCopy "d:\sourcefolder\OutputFile.PRN", "d:\linkfolder\OutputFile.txt"



    Gustav Brock

    Saturday, January 25, 2020 8:58 AM
  • Asking the users that produce/update the .PRN files in question to copy/change/update the files is a non-starter.
    The users don't need to do anything.  In your Access application kill a .txt file copy of the .prn file to which you have already created a link, then copy the .prn file to a new .txt file of the same name by calling the FileCopy statement.  Depending on how up to date the link needs to be, you can either do this at start-up, or when you open any form or report bound to the linked table.

    You will of course have to handle the error which will occur if you call the FileCopy statement while the .prn file is open.  Rather than killing the .txt file outright before the FileCopy method is called, you can rename it in the code and only if the FileCopy is successful kill the renamed file. otherwise rename it back to its original name.


    Ken Sheridan, Stafford, England

    Saturday, January 25, 2020 2:11 PM