[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 85
  • Last Modified:

Access MDB/PDF

I've got an application running in an old version of Access (have to leave it there because of the toolbars), which I've been using pdf995 to print invoices.
The trouble is, the pdf995 runs async and doesn't notify back to access vba when its finished (it just sends a sleep() call and hopes) and the invoice routine is a batch and sometimes a new invoice gets printed into a the wrong pdf file, with extreme agony to all concerned as you can imagine.
Is there a pdf printing mechanism available to the old Access which somehow copes with synching back to the vba?
0
Silas2
Asked:
Silas2
  • 8
  • 7
  • 3
  • +3
1 Solution
 
Joe Winograd, EE MVE 2015&2016DeveloperCommented:
I don't use Access much (old or new), but you could have Pdf995 name the PDF based on the original document name, which is surely unique, containing the (unique) invoice number. You'll need to use PdfEdit995 for this, which is part of the Pdf995 Suite. The file naming feature that you'll use is #9 at this page:
http://www.pdfedit995.com/

Specifically, 9.b.:
Automatically name the document based on the originating document and save it in the pdf995\output folder.
Using that technique, a new invoice will never get printed into the wrong PDF file — each one will always be in its own PDF file. Regards, Joe
0
 
Rey Obrero (Capricorn1)Commented:
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
here is a free tool to write Reports to PDF by Lebans
http://www.lebans.com/reporttopdf.htm
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
Silas2Author Commented:
The shellandwait looks interesting, the only thing is the process is not as easy to disentangle because the invocation is simply : OpenReport (and the report's printer is set to pdf995)
That's where the trouble starts, if pdf995 hasn't finish the previous report when a new report is sent to it, it just stamps the new one into the one being made.
That's why tinkering with filename changes doesn't get round the problem. I'm not sure if sending it to a new folder might work.....although looking at the code, pdf995 does spit out a finished flag....I've only just had the screaming phone call, trouble is, its a very difficult issue to replicate, when you step thru the code it never does it...
0
 
Joe Winograd, EE MVE 2015&2016DeveloperCommented:
> That's why tinkering with filename changes doesn't get round the problem.

Doesn't the original file, i.e., the invoice from which the PDF is being created, have a unique file name?
0
 
Silas2Author Commented:
Each report has a unique name but pdf995 does not finish one file before the vba has squirted more stuff in from a different report.
0
 
Joe Winograd, EE MVE 2015&2016DeveloperCommented:
> Each report has a unique name but pdf995 does not finish one file before the vba has squirted more stuff in from a different report.

Unless I'm not understanding the process, that doesn't matter if each source file, and the PDF created from each one, have different/unique names, as you can do with PdfEdit995.

P.S. Leaving for Thanksgiving dinner now. Will check back into the thread tomorrow.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
<<That's where the trouble starts, if pdf995 hasn't finish the previous report when a new report is sent to it, it just stamps the new one into the one being made.>>

 I use my own variation of ShellAndWait() and I don't have issues.    I haven't worked with pdf995 specifically though (I use a printer driver with PS output, then use GhostScript to convert it to a PDF),  but what you want to do is set the printer to not allow spooling.  That should take care of that problem.

Jim.
0
 
John TsioumprisSoftware & Systems EngineerCommented:
Lebans solution mentioned by crystal...is quite good although not perfect...i think you should take a look...we having being using if for years....for everything from invoices to technical documents....it has some issues but usually they are related to machines who have a lot of background tasks....
Also if you don't mind doing some tests...PDF Factory has a server edition which has proven to be stable and has many features....if you insist on something free PDFCreator is also nice but needs extra tweaking
If i remember correctly PDF995 was limited and cumbersome so some testing won't hurt
0
 
Silas2Author Commented:
Thanks, I'm just waiting for the mdb to turn up snail/mail so I can see if i can replicate. That is a problem with my favourite old workbench - the files are local and just grow and grow.
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
> "the files are local and just grow and grow"

do you compact/repair on a regular basis? This should only be done right after the database is backed up.
0
 
Silas2Author Commented:
These mdb's seem to be so resilient. I do tend to make a purge/year end function, so they shouldn't grow that big but even 100mb is quite a small one, and have you found a way of getting that over a slow internet connection?
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
zip and upload to a website. Then once it is downloaded, overwrite file on the website with another one having the same name (such as temporary.zip). Alternately you can use something like DropBox, which I personally don't like but others use it.
0
 
Silas2Author Commented:
Wow, I've just noticed the VBA code from the pdf995 website isn't properly setting and unsetting the 'busy' flag , thats why it was always ok to start another. There is another sample in a different language with a clearer 'end of print process app to run' . I've got that faulty sample code running elsewhere as well....i wonder if I should alert them....
0
 
Joe Winograd, EE MVE 2015&2016DeveloperCommented:
> i wonder if I should alert them

Absolutely! I'm sure they'll be grateful.
0
 
Silas2Author Commented:
But its been running for 5-10years without any complaint!

The reason I think it just sprang a leak out of the blue is that there is 5 second delay before it checks the flag, and an old PC must have suddenly breached the 5 seconds.
0
 
Joe Winograd, EE MVE 2015&2016DeveloperCommented:
> But its been running for 5-10years without any complaint!

Doesn't matter. A bug is a bug. They'll want to know about it. I still don't understand your process...seems to me that different filenames for the created PDFs avoids the problem, but that's a different story.
0
 
Silas2Author Commented:
Different names doesn't solve it, its a single process running async, if you send another file (with a different name) before the async process is complete, it stamps the new content into the unfinished file, it doesn't spin up a new process for the new file.
0
 
Joe Winograd, EE MVE 2015&2016DeveloperCommented:
Then the PdfEdit995 feature of automatically naming the PDF document based on the name of the source document (and then saving it in the Pdf995 output folder) doesn't have much value...hard to believe they would have built it that way.
0
 
Silas2Author Commented:
It has a value, I name all files InvoiceXXX.pdf etc, but...that doesn't stop subsequent files from stamping their content in if the process isn't finished.

The issue is, http://www.pdf995.com/faq_dev.html, if you search for applicationthatdeletesflagfilethatyousupply on that page you can see the C++ version of clearing the flag, whereas the vba code:
http://www.freeware995.com/misc/vbacode.txt
In the line:
Do While ReadINIfile("PARAMETERS", "Generating PDF CS", syncfile) = "1"
Its checking the flag "Generating PDF CS" in the INI file, but that flag is never getting set (as far as i can see).
I copied the pattern from the C++ code and put a del cmd in  .bat file in for applicationthatdeletesflagfilethatyousupply, so make 'imbusy.txt' in VBA then delete with the .bat.
0
 
Joe Winograd, EE MVE 2015&2016DeveloperCommented:
OK, thanks for the explanation — much appreciated!
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 8
  • 7
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now