Fastest way to print large data (1 Viewer)

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:05
Joined
Feb 19, 2002
Messages
42,981
We never got an answer regarding the actual time to print a large batch of documents and we don't know how much time printing to a pre-printed form will even save. The first is a simple measurement. The second takes a little more work. You just copy the original report and replace the parts of the document that will be in the "form" with blanks to simulate empty space. The "blanks" are only there as place holders to get the printable stuff positioned correctly on the page.

So the entire expense of paying for setup and buying pre-printed forms may be completely unnecessary.
 

Hello1

Registered User.
Local time
Today, 04:05
Joined
May 17, 2015
Messages
271
Hello guys,
I came across this thread and now I want to print directly from VBA without first saving the text to a txt file.
Send Text Directly To Printer
In the thread at the end the creator of it ended up with exporting text to a txt file and then printig, however, I saw this post there:
At the stage you are now, the simply method is to write directly to the printer skipping the text file:
pen "LPT1" For Output As #1
Of course, the printer must be attached to the port either physically using the Centronics interface (parallel port) which most matrix printers have; or the LPT1 port (or other port you choose to use) must use a network printer:
Net Use LPT1 \\YourPrinterServer\ShareNameForTheOKI
This is way faster than anything else as it will drive the printer directly at its maximum printing speed.
The other option is to go back and redesign the report. Use the Generic Printer driver of Windows at least as a start, and design _any_ object (label, textbox) on the report using only monospaced fonts which the printer understands and always using a line spacing in parts of inches _exactly_ matching the font and printer.
Both methods are proven and "easy" (=nothing difficult to learn or understand) but - as you already have experienced - designing a report for a matrix printer requires amble time and patience. If you feel it takes two or three times the time you would expect, you are not alone.
Luckily, here we haven't had clients for years using matrix printers but I still recall those long days.
/gustav

Then I came across this thread
How do I simulate a parallel (LPT) Printer with a USB Printer?

So I did as follows:
You can trick Windows by using the USB printer as a dummy "network" printer connected to LPT1.

Share the USB printer

Use a share-name easy to remember, such as "Printer".

Connect the shared printer as LPT1

NET USE LPT1: \\[Computer-Name]\Printer /PERSISTENT:YES
The printer Im testing this one is a Samsung SCX-4x21 Series (USB001). So I shared the printer (gave it the name SamsungPrinter) and wrote the next code in my VBA:
Code:
Open "\\[Computer-Name]\SamsungPrinter" For Output As #1

Print #1, "Some text bla bla"
With the settings bellow nothing happens.
1594329890435.png


The document appears just like this and when the code reaches the "Close #1" and executes, the document just disappears.
Even if I try it from CMD "print D:\Path\test.txt /d:LPT1", same happens.
However, printing a test page works.

1594330120517.png



Next with the settings bellow:
1594330282847.png


If I execute the same code and same CMD command the document constantly appears and disappears with the status changing from Spooling, Printing, Deleting ... but nothing happens. Printing a test page also doesnt work.

Im using Windows 10. Any suggestions?
Later one when I figure all out and set it up I would like to compare the speed between report printing and printing text from VBA. I will share the results here, if I ever reach that point.
Thanks! :)
 

isladogs

MVP / VIP
Local time
Today, 02:05
Joined
Jan 14, 2017
Messages
18,186
@Hello1
You said you 'came across this thread' but as you started the thread that's rather odd!
 

Isaac

Lifelong Learner
Local time
Yesterday, 19:05
Joined
Mar 14, 2017
Messages
8,738
@Hello1
You said you 'came across this thread' but as you started the thread that's rather odd!
I thought it was a reference to the thread link posted directly after that sentence?
 

Hello1

Registered User.
Local time
Today, 04:05
Joined
May 17, 2015
Messages
271
I thought it was a reference to the thread link posted directly after that sentence?
It was, sorry for the confusion. Could have wrote it more precisely but its been a long day 😅
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:05
Joined
Feb 19, 2002
Messages
42,981
Anything you do with a vba code loop will be slower than an optimized internal Access function.

You never told us how long it takes to print a report with all the graphics.
You never told us how long it takes to print a report with just the text.

If you didn't take these measurements, how will you know that your latest "solution" which requires the expense of preprinted forms, will be faster?
 

Isaac

Lifelong Learner
Local time
Yesterday, 19:05
Joined
Mar 14, 2017
Messages
8,738
Anything you do with a vba code loop will be slower than an optimized internal Access function.
If you didn't take these measurements, how will you know that your latest "solution" which requires the expense of preprinted forms, will be faster?
Rendering & printing of 100% of a typically designed Access report, faster than using for Output/Print on the pure text results of a query?
Have to admit I've never compared these two things directly, but would be curious ..
 

Hello1

Registered User.
Local time
Today, 04:05
Joined
May 17, 2015
Messages
271
Anything you do with a vba code loop will be slower than an optimized internal Access function.

You never told us how long it takes to print a report with all the graphics.
You never told us how long it takes to print a report with just the text.

If you didn't take these measurements, how will you know that your latest "solution" which requires the expense of preprinted forms, will be faster?
I didnt have the chance to compare yet. Its not that I want to go with pre-printed forms but I have to :D
Once I manage to complete the Output/Print procedure I will compare one to another in terms of speed.
I had some success with a program called Printfil after sharing my printer and using Net Use LPT1 \\YourPrinterServer\ShareNameForTheOKI, in VBA I use Open "LPT1:" For Output As #1 and it prints one page, however not all of them.
DOSPrinter performed much faster, however, I didnt manage get to print with it directly from VBA, only CMD and the program itself. In CMD I cant figure how to define code page for eastern europe because of special characters like šđčćž...
I will try tonight to do some more researching
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:05
Joined
Feb 19, 2002
Messages
42,981
Rendering & printing of 100% of a typically designed Access report, faster than using for Output/Print on the pure text results of a query?
The poster was using the VBA Print function which requires a vba loop to read each record, format the line to print, and print it. The logic also has to print blank lines to ensure that the text is in the right spot on the page which means there will be additional If's within the loop..
 

Users who are viewing this thread

Top Bottom