PDF and open report in acViewPreview or acHiddden

G

Guest

Hi all,
I think I should email this to Stephen Lebans, but since I have couple more
question and thought it may benefit to other people here in this forum so I
posted out here.
First, I would like to say thank you specially to Stephen Lebans for your
code to convert Report to PDF avaible for me (and everyone else) to use.
Second, I have a problem with what to do with docmd.openreport...
Since I have to let user to do the filter and order by before they click
convert button. Here's part of my code:
..
..
..
qd1.SQL = qd1.SQL & myCriteria

End If

'DoCmd.OpenReport cbxReportName.Value, acViewPreview, , , acHidden

DoCmd.OpenReport cbxReportName.Value, acViewPreview
Set rp = Reports(cbxReportName)
rp.OrderBy = sList
rp.OrderByOn = True

End If

' Call our convert function

blRet = ConvertReportToPDF(Me.cbxReportName.Value, vbNullString, _
0, True, True, 0, "", "", 0, 0)

If I open report with acViewPreview then the convert to PDF file work pretty
well with filter and orderby the first time I click (this is what it supposed
to). Since if the user click the convert to PDF button (I have 3 more
command button), they don't want to see the report! they just want to see the
Adobe file, so I tried acHidden option (as the code I put in comment), this
is what I have: 1st time I click it (after fill in the filter) the result is
from the previous filtered, and the report is in-visibale, second click (same
as the filter i had with click 1), I saw the report visible, and the PDF
filter have correct filter and order... I know my filter and orderby work
pretty well. I must be the matter of the report open as view or hidden???
I'm think of open the report as preview (as the code above) and close the
report right away? How do I close that practicular report? I tried
docmd.close acreport(me.cbxReportname) but doesn't work...

Thanks in advance for your help...
 
G

Guest

Opss, I mean to post this thread in Access Reports not Programming:( What
should I do now? I don't want to create duplicate thread.
 

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