Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting as .PRN file Not .txt File Type 1

Status
Not open for further replies.

PSUIVERSON

Technical User
Nov 6, 2002
95
US
I have setup a system of shooting tables out to text files but would like to send it out as a .PRN file and not .txt file for some of them. What VBA would I use?

I tried this but it says file is read-only?!

' Write table for each DEPTNO to text file FIXED WIDTH (SDF)
DoCmd.TransferText acExportFixed, "PDPTDCUMtxt Export", "PDPTDCUMtxt", "C:\Download\Dept_TEST\" & deptNo & "\PDPTDCUM_SDF.PRN"


Anyone done this before?

Thanks...
 
perhaps the is set to read only try
if GetAttr("C:\Download\Dept_TEST\" & deptNo & "\PDPTDCUM_SDF.PRN"
")= vbreadonly then SetAttr ("C:\Download\Dept_TEST\" & deptNo & "\PDPTDCUM_SDF.PRN" ,vbnormal
 
HI

You do not say which version of Access you are using, but I assume Access2000?

In Access2000 (well Jet4 to be more precise) you get the misleading error message about the databse being read only if you try to import or export data from/to a text file, where the extension of the text file is not in a preset list, recorded in the registry (defaults are txt, csv, tab, asc).

Solution, use one of the preset extensions, or (carefully) use regedit to edit the appropriate registry entry

HKey_Local_Machine\Software\Microsoft\Jet\4.0\Engines\text
Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
pwise - Thanks but that didn't do it. Appreciate the adice though...

Ken,

I updated the Extensions(HKey_Local_Machine\Software\Microsoft\Jet\4.0\Engines\text\Extensions) in the Registry to now include

txt,csv,tab,asc,prn

Where as the previous setting was

txt,csv,tab,asc

However it did not seem to take. Any thoughts?

Thanks and Merry Christmas.

 
try exporting to a file extensions that it will accept and renameing he file

Name oldfilename As newfilename
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top