How to Export .prn file from Access 2003.

dz2k7

Not only User
Local time
Today, 01:41
Joined
Apr 19, 2007
Messages
104
Hi there,
I need to export the table from access 2003 into .prn file.
By some reasons we use that kind of files for uploading into anther DB in AS400 (which is stupid, but we can't change that).
I can't find the option in Acess to export as .prn
I can do that from excel but amount of lines is much bigger than 100000 so I need to do it from Access directly.

I tried to export as .txt and rename into prn, but it dosen't work for the upload as the file structure is different.

The upload works only if there is sertain width between the data.

May be there is a way of converting the txt file into prn....
Just a tought...

Thanks to everybody who read this.
 
I know you can 'print' to a .prn manually. Not sure how to do this from Access though.

-dK
 
so looks like nobody knows....
 
You can export as a fixed width delimited file. Is that what you need?
 
No,

Ii tried doing that.
It creates txt file that have different structure.
It doesn't work for the upload.
 
PRN files don't have a universal structure, in the company I work for they are usually exports from the Mainframe and sometimes raw data dumps, other times they are formatted. You need to determine what type of file is currently there so you can replicate it. In my experience these are usually fixed width files, if you setup a file spec you could export using that to create the file as needed. My preferred method would be using the Open & Print commands in VBA which give me more control over the formatting.
 
We have the Excel tamplate formated the certain way.
So when we create prn file from Excel it has determined spaces and stuff.

Can you help? PLease
 
We have the Excel tamplate formated the certain way.
So when we create prn file from Excel it has determined spaces and stuff.

Can you help? PLease

Since Excel doesn't list PRN as an export option to my knowledge I'm going to assume that the Excel workbook has some VBA code behind it creating the PRN file for you. Look at that code for an example of what it's doing (press ALT+<F11> to bring up the VBA editor in Excel).
 
Excel does list prn as an export option, Access does not.
This is my problem.
 
Excel does list prn as an export option, Access does not.
This is my problem.

I stand corrected then, well there's two options as I see it. You can use an Excel object from within Access, transfer your data from a table/query to an Excel workbook, then use the SaveAs option to save the WorkBook as a PRN file. This is messy but it should work.

The PRN file output from Excel seems to be a Space delimited format, if you export your query or table as space delimited you should get the same results.
 
the problem is the limit in Excel 65536 lines. (last version about 100000)
I have 500000 and more sometimes.
 
Looks like you might need to export in stages, say 10 tables, then import them all by appending them in sequence?
 
is it possible to append to the existing prn file from Excel?
 
the problem is the limit in Excel 65536 lines. (last version about 100000)
I have 500000 and more sometimes.

Then forget Excel completely. If all your records are in one table or query then you just need to export it as a text file *.txt and choose delimited as the export type, then choose space delimited. Once it's exported just change the file extension from .txt to .prn
 
well i did that, but the structure of txt file is different from prn.
it's not visible in notepad.
so renaimed txt file does not work for the upload we need.
 
well i did that, but the structure of txt file is different from prn.
it's not visible in notepad.
so renaimed txt file does not work for the upload we need.

Ok...so clearly Excel is doing some formatting beyond just saving it as a .PRN. Is there a macro or some code that is run in Excel before you save it?
 
I've just done a simple export from Excel as a prn file. I can open this in Notepad and its simply a fixed width text file. So I don't understand what's going on?
 
it would be fine if i could use csv.
i can't because the upload program is been done based on prn.
we can't change this program, we only can trick it.

in notepad txt having determined widthes and prn look same, but actually files have different structure.

it looks like there is no answer...

but thanks to everybody
 
it would be fine if i could use csv.
i can't because the upload program is been done based on prn.
we can't change this program, we only can trick it.

in notepad txt having determined widthes and prn look same, but actually files have different structure.

it looks like there is no answer...

but thanks to everybody

It's not that there isn't an answer...it's that there isn't an EASY answer. The PRN and txt file look the same so that means that there is a difference you can't quite see, possibly delimiting character, or the line termination character, or extra characters that you can't see.

To find where the differences are you need to compare the two files byte by byte to see where the data is different and then adjust your program accordingly. You can use a hex editor program if you have one, or you can read the files in VBA as binary files and look at the individual bytes that way. I've done this numerous times to recreate input files for old mainframe applications, but it requires a bit of skill to do.
 

Users who are viewing this thread

Back
Top Bottom