Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access MDB/PDF

Posted on 2016-11-24
21
Medium Priority
?
83 Views
Last Modified: 2016-12-01
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
Comment
Question by:Silas2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
  • 3
  • +3
21 Comments
 
LVL 56

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 41900786
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 41900789
0
 
LVL 22
ID: 41900796
here is a free tool to write Reports to PDF by Lebans
http://www.lebans.com/reporttopdf.htm
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 

Author Comment

by:Silas2
ID: 41900807
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
 
LVL 56

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 41900849
> 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
 

Author Comment

by:Silas2
ID: 41900860
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
 
LVL 56

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 41900862
> 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
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 41901556
<<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
 
LVL 19

Expert Comment

by:John Tsioumpris
ID: 41903687
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
 

Author Comment

by:Silas2
ID: 41904472
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
 
LVL 22
ID: 41904502
> "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
 

Author Comment

by:Silas2
ID: 41904533
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
 
LVL 22
ID: 41904542
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
 

Author Comment

by:Silas2
ID: 41908585
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
 
LVL 56

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 41908890
> i wonder if I should alert them

Absolutely! I'm sure they'll be grateful.
0
 

Author Comment

by:Silas2
ID: 41908915
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
 
LVL 56

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 41908947
> 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
 

Author Comment

by:Silas2
ID: 41908976
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
 
LVL 56

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 41908991
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
 

Author Comment

by:Silas2
ID: 41909015
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
 
LVL 56

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 41909023
OK, thanks for the explanation — much appreciated!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question