By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

preferred method to filter Lebans' ReportToPdf

P: n/a
I could not find a good method to pass a where clause or openargs to a
report named in a call to stephen Lebans' fine reportToPDF utility.l.

Do you have a good method to pass a PK to the report so you can print
a single record to an individual pdf?.

I've got 2500 records to make into .pdfs, (project manager says it's
what customer wants)
and I've put the report2pdf call inside a loop. It works, but ignores
any filter clause I try to pass (using a one field, on record table,
or a public variable or a query criteria to a form, etc...

Thanks

Bob Q

Sep 22 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
"rq******@sympatico.ca" <bo*********@gmail.comwrote in message
news:ae**********************************@m44g2000 hsc.googlegroups.com...
>I could not find a good method to pass a where clause or openargs to a
report named in a call to stephen Lebans' fine reportToPDF utility.l.

Do you have a good method to pass a PK to the report so you can print
a single record to an individual pdf?.
Yes, just open the report BEFORE you call the pdf routines.

eg:
strReportName = "rptInvoice"

DoCmd.OpenReport strReportName, acViewPreview, , strWhere
Reports(strReportName).Visible = False
Call ConvertReportToPDF(strReportName, , strDocName, False, False)

DoCmd.Close acReport, strReportName

Note how the "strwhere" could be for the current reocrd

strWhere = "id = " & me!id

And, don't forget to "close" the report as above after you are done...

So, open the report with all of your filter options etc BEFORE you call the
pdf routines.....
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
>

Sep 23 '08 #2

P: n/a
rq******@sympatico.ca wrote:
I could not find a good method to pass a where clause or openargs to a
report named in a call to stephen Lebans' fine reportToPDF utility.l.

Do you have a good method to pass a PK to the report so you can print
a single record to an individual pdf?.

I've got 2500 records to make into .pdfs, (project manager says it's
what customer wants)
and I've put the report2pdf call inside a loop. It works, but ignores
any filter clause I try to pass (using a one field, on record table,
or a public variable or a query criteria to a form, etc...

Thanks

Bob Q
I coded something for his program just today. I have a report that can
be called from several forms. There's only 1 form that will be calling
the routine to create the PDF file. So in my OnOpen event of the report
I did something like
If IsLoaded("formname") then 'google for example of isloaded()
If not isnull(Forms!FormName!ReportFilter) then
Me.Filter = Forms!FormName!ReportFilter
Me.FilterOn = True
Endif
Endif

Then in my routine to call Stephen Lebans code it's something like this
Dim blnOK As Boolean
Forms!MainForm!ReportFilter = "CustomerID = 1"
blnOK = ConvertReportToPDF...
Forms!MainForm!ReportFilter = Null

Stephen's code works like a charm.
Sep 23 '08 #3

P: n/a
Salad <oi*@vinegar.comwrote:
>So in my OnOpen event of the report
I did something like
If IsLoaded("formname") then 'google for example of isloaded()
If not isnull(Forms!FormName!ReportFilter) then
Me.Filter = Forms!FormName!ReportFilter
Me.FilterOn = True
Endif
Endif

Then in my routine to call Stephen Lebans code it's something like this
Dim blnOK As Boolean
Forms!MainForm!ReportFilter = "CustomerID = 1"
blnOK = ConvertReportToPDF...
Forms!MainForm!ReportFilter = Null

Stephen's code works like a charm.
I use something very similar. Except that I use a Global Options Hidden form bound
to a global options table on which I throw a tab control. And I put miscellanious
fields such as the one Salad uses as well.

This form also takes care of the performance problem issue.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Sep 23 '08 #4

P: n/a
On Sep 23, 6:58*pm, "Tony Toews [MVP]" <tto...@telusplanet.netwrote:
Salad <o...@vinegar.comwrote:
So in my OnOpen event of the report
I did something like
* *If IsLoaded("formname") then *'google for example of isloaded()
* * * * * *If not isnull(Forms!FormName!ReportFilter) then
* * * * * * * * * *Me.Filter = Forms!FormName!ReportFilter
* * * * * * * * * *Me.FilterOn = True
* * * * * *Endif
* *Endif
Then in my routine to call Stephen Lebans code it's something like this
* *Dim blnOK As Boolean
* *Forms!MainForm!ReportFilter = "CustomerID = 1"
* *blnOK = ConvertReportToPDF...
* *Forms!MainForm!ReportFilter = Null
Stephen's code works like a charm.

I use something very similar. *Except that I use a Global Options Hidden form bound
to a global options table on which I throw a tab control. * And I put miscellanious
fields such as the one Salad uses as well.

This form also takes care of the performance problem issue.

Tony
--
Tony Toews, Microsoft Access MVP
* *Please respond only in the newsgroups so that others can
read the entire thread of messages.
* *Microsoft Access Links, Hints, Tips & Accounting Systems athttp://www.granite.ab.ca/accsmstr.htm
* *Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/- Hide quoted text -

- Show quoted text -
Thanks to all 3 of you for your responses. Albert's method worked
beautifully, although I'm surprised at the fact that opening an open
form respects the filter on the first form, instead of the form
defaults.

However, I do intend to update the code to use Salad's and your method
mecause I find the flickering of the report being opened, closed and
reopened 2022 times a little annoying.

As to performance, it took about 20 minutes to create the 2000+ .PDFs,
2 to 5 pages each.

Q

Sep 24 '08 #5

P: n/a
"rq******@sympatico.ca" <bo*********@gmail.comwrote:
>As to performance, it took about 20 minutes to create the 2000+ .PDFs,
2 to 5 pages each.
So a hundred a minute isn't bad at all. Gotta love Stephen's solution. I sure do!

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Sep 24 '08 #6

P: n/a
On Sep 24, 6:37*pm, "Tony Toews [MVP]" <tto...@telusplanet.netwrote:
"rquin...@sympatico.ca" <bob.quin...@gmail.comwrote:
As to performance, it took about 20 minutes to create the 2000+ .PDFs,
2 to 5 pages each.

So a hundred a minute isn't bad at all. * Gotta love Stephen's solution.. *I sure do!

Tony
He's da man!

Thanks Stephen, for all your fine work.
Sep 24 '08 #7

P: n/a
"rq******@sympatico.ca" <bo*********@gmail.comwrote in message
news:2e**********************************@m36g2000 hse.googlegroups.com...
On Sep 24, 6:37 pm, "Tony Toews [MVP]" <tto...@telusplanet.netwrote:
"rquin...@sympatico.ca" <bob.quin...@gmail.comwrote:
As to performance, it took about 20 minutes to create the 2000+ .PDFs,
2 to 5 pages each.

So a hundred a minute isn't bad at all. Gotta love Stephen's solution. I
sure do!

Tony
>He's da man!
>Thanks Stephen, for all your fine work.

Yes, I have to throw in a big thanks to that Stephen guy.....it is a fab pdf
maker.....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Sep 26 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.