Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
Programming
 EXP Systems Forum : PDF reDirect : Programming
Topic: Access VBA Report Filtering and Emailing Post Reply Post New Topic
Author Message
David_Carle
Newbie
Newbie
Avatar

Joined: 26 May 09
Posts: 36
Quote David_Carle Replybullet Topic: Access VBA Report Filtering and Emailing
    Posted: 26 May 09 at 7:52PM
Hi
I'm reviewing PDF generating tools to replace a well known product that doesn't work reliably for me, and would like to ask a few questions before using PDF reDirect.

1. Using Access 2003, is it possible to apply criteria (eg a where clause) to an access report at run time, just prior to printing to pdf?
(eg printing an invoice report for each individual invoice, to be emailed to each customer in turn)
If so, what is the best way to do this?

2. Do you have any sample code that emails the newly created pdf file?

3. Have you encountered any problems with pdf's being created and emailed faster than the email client (Outlook 2003) can handle them?

4. Are there issues with the Outlook security "feature" prompting the user to allow access to its address book?
If so, does PDF reDirect work with other products such as ClickYes?

Thanks for any advice.


IP IP Logged
Michel_K17
Moderator Group
Moderator Group
Avatar
Forum Administrator

Joined: 25 Jan 03
Posts: 1673
Quote Michel_K17 Replybullet Posted: 26 May 09 at 11:32PM
Hello,

   Thank you for considerering PDF reDirect.

   First off, if you want to control PDF reDirect remotely, you will need to use the "Professional" version plus add the ActiveX component and sample code which includes e-mail support, or you can use your own e-mailing code.

   With respect to the 1st question, yes, you can generate reports for individual customers using Access. However, there are plenty of programming help sites that can help you with that problem. Unfortunately, I do not provide programming advice through this business: sorry. I would check any number of VBA help sites and forums. The biggest one is: www.vbforums.com and there is also www.xtremevbtalk.com.

   Question #2: Yes. Please check the sample VBA code that comes with the ActiveX component [here].

   Question #3. Yes, you can definitely overwhelm the system. Best thing is to throttle your conversion so that you stay within the bounds of your system. This is done by checking that the PDF file has been fully written and the e-mail sent before converting the next form to a PDF (assuming you send the e-mail). However, the sample code I provide shows how to send the e-mail using my component. Again, all you really need to do is to try to not generate PDF files more quickly than they are processed, ie: wait for the component to complete creating the PDF and sending the e-mail before moving on to the next job. Look at the "PdfCreated" function for which I have included the code.

   Question #4. Yes, the Outlook security feature is a pain, and is very hard to fully automate without requiring some sort of human intervention. Therefore, you might be best to use the SMTP e-mail feature in my component that does not use Outlook, or to use a 3rd party e-mail component. In PDF reDirect Pro, I use the SMTP component from www.ostrosoft.com, but not their latest version (v7) which uses .NET technology. I use an older COM version.

   I hope that helps,


Michel Korwin-Szymanowski
EXP Systems LLC
IP IP Logged
David_Carle
Newbie
Newbie
Avatar

Joined: 26 May 09
Posts: 36
Quote David_Carle Replybullet Posted: 28 May 09 at 3:10PM
I have now had a chance to examine the VBA code of the Access demo in more detail, and have the answer to my first question, namely how to filter the data in the report.
 
What I did was to amend the code in the modCode module as follows:
In Convert2Pdf, I added a parameter:
Optional ByRef WhereClause As String = ""
This is then passed as a parameter to PrintOutputToBatchPrinter as follows:
TempBool = PrintOutputToBatchPrinter(MyDocumentName, MyBatchPrinter, WhereClause)
 
Next, in PrintOutputToBatchPrinter I added the same parameter as for Convert2Pdf
 
Then I added the parameter to the OpenReport lines as follows:
DoCmd.OpenReport MyDocumentName, acViewPreview, , WhereClause ' Generate a Preview First
DoCmd.OpenReport MyDocumentName, acViewNormal, , WhereClause ' Print the Report
 
To Test this, I amended cmdExportPDF_Click in frmMain as follows:
Convert2Pdf MyDocumentName, MyBatchPrinter, MyOutputPath, MyOutputFilename, , , "UserName = 'Michel_K17'"
(Note the 3 commas before the where condition.
 
I hope this helps anyone else who is evaluating or using your software.
 
IP IP Logged
Michel_K17
Moderator Group
Moderator Group
Avatar
Forum Administrator

Joined: 25 Jan 03
Posts: 1673
Quote Michel_K17 Replybullet Posted: 28 May 09 at 11:03PM
Hi,

   Wow: good job! Thanks for posting your improvements.

   Cheers!


Michel Korwin-Szymanowski
EXP Systems LLC
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum