Lebans Report2PDF - Convert a specific record - How?

G

Guest

Hi

I have the following sub procedure in my database:
===============================
Dim blRet As Boolean
Dim strPath As String
Dim strFName As String
Dim strPRNo As String
Dim strPDFout As String

strPRNo = Me.PRREQNo
strPath = "g:\IT\PurchaseRequests\pdf"
strFName = "pr" & strPRNo
strPDFout = strPath & "\" & strFName

blRet = ConvertReportToPDF("PRRequisition Report", vbNullString, strPDFout &
".pdf", False, True, 0, "", "", 0, 0)
==================================
It works great, except I only want to convert a specific record instead of
all the records in the reports table.

How do I specify a single record for PDF conversion?
 
C

Case Cybermancer

One possible solution is to use the filter property on the report to display
only the records you wish to convert to PDF. As you wish to create a single
pdf per record, you could consider retrieving a recordset and iterating
through each record. In each iteration call the report whilst passing the
record identifier through as a report parameter. This can then be used to
set the filter property and display one record at a time. Use the statement
below to output each report to pdf.

This may not be the best way to do this but for the moment I cannot think of
a better way... I stand to be corrected on this one. I hope this proves of
some value.
 
G

Guest

Case Cybermancer said:
One possible solution is to use the filter property on the report to display
only the records you wish to convert to PDF. As you wish to create a single
pdf per record, you could consider retrieving a recordset and iterating
through each record. In each iteration call the report whilst passing the
record identifier through as a report parameter. This can then be used to

To print a specific record I use the DoCmd code below:

stDocName = "PRRequisition Report"
Me.Refresh
DoCmd.OpenReport stDocName, acNormal, , "[PRRequisition].[PRID] =
Forms![PRRequisition]![PRID]"

How do I pass the record Identifier to the ConvertReport2PDF function?
set the filter property and display one record at a time. Use the statement
below to output each report to pdf.

Which statement are you referring to?
 
C

Case Cybermancer

A report has both a "Filter" property and a "Where clause" property.

What I was thinking you could try is to setup the report to effectively
include only one record at a time (by setting either the Filter or the Where
properties of the report -- see which works based on what you wish to do).
Then call the print command you mentioned below -- effectively printing a
"one record" report. Thereafter you would have to iterate through each
record one at a time setting either the Filter or Where clause accordingly
and repeating the print instruction.

It's not elegant but, if I've understood your problem correctly, it should
do what you want it to do.
Let me know if it worked out okay for you.

Regards,
Case

Tec92407 said:
Case Cybermancer said:
One possible solution is to use the filter property on the report to
display
only the records you wish to convert to PDF. As you wish to create a
single
pdf per record, you could consider retrieving a recordset and iterating
through each record. In each iteration call the report whilst passing the
record identifier through as a report parameter. This can then be used to

To print a specific record I use the DoCmd code below:

stDocName = "PRRequisition Report"
Me.Refresh
DoCmd.OpenReport stDocName, acNormal, , "[PRRequisition].[PRID] =
Forms![PRRequisition]![PRID]"

How do I pass the record Identifier to the ConvertReport2PDF function?
set the filter property and display one record at a time. Use the
statement
below to output each report to pdf.

Which statement are you referring to?
This may not be the best way to do this but for the moment I cannot think
of
a better way... I stand to be corrected on this one. I hope this proves
of
some value.
 
G

Guest

Case

You were correct.
All I had to do was put a fiter statement in the Report's "On Open" event.

Filter = "[PRID] = Forms![PRRequisition]![PRID]"
FilterOn = true

Works correctly now.

Thanks for your help.

Case Cybermancer said:
A report has both a "Filter" property and a "Where clause" property.

What I was thinking you could try is to setup the report to effectively
include only one record at a time (by setting either the Filter or the Where
properties of the report -- see which works based on what you wish to do).
Then call the print command you mentioned below -- effectively printing a
"one record" report. Thereafter you would have to iterate through each
record one at a time setting either the Filter or Where clause accordingly
and repeating the print instruction.

It's not elegant but, if I've understood your problem correctly, it should
do what you want it to do.
Let me know if it worked out okay for you.

Regards,
Case

Tec92407 said:
Case Cybermancer said:
One possible solution is to use the filter property on the report to
display
only the records you wish to convert to PDF. As you wish to create a
single
pdf per record, you could consider retrieving a recordset and iterating
through each record. In each iteration call the report whilst passing the
record identifier through as a report parameter. This can then be used to

To print a specific record I use the DoCmd code below:

stDocName = "PRRequisition Report"
Me.Refresh
DoCmd.OpenReport stDocName, acNormal, , "[PRRequisition].[PRID] =
Forms![PRRequisition]![PRID]"

How do I pass the record Identifier to the ConvertReport2PDF function?
set the filter property and display one record at a time. Use the
statement
below to output each report to pdf.

Which statement are you referring to?
This may not be the best way to do this but for the moment I cannot think
of
a better way... I stand to be corrected on this one. I hope this proves
of
some value.


Hi

I have the following sub procedure in my database:
===============================
Dim blRet As Boolean
Dim strPath As String
Dim strFName As String
Dim strPRNo As String
Dim strPDFout As String

strPRNo = Me.PRREQNo
strPath = "g:\IT\PurchaseRequests\pdf"
strFName = "pr" & strPRNo
strPDFout = strPath & "\" & strFName

blRet = ConvertReportToPDF("PRRequisition Report", vbNullString,
strPDFout
&
".pdf", False, True, 0, "", "", 0, 0)
==================================
It works great, except I only want to convert a specific record instead
of
all the records in the reports table.

How do I specify a single record for PDF conversion?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top