UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Outputto Method Question    
 
   
petite39
post Mar 20 2012, 08:35 AM
Post #1

UtterAccess Ruler
Posts: 1,051



I used to do this:

DoCmd.OpenReport stDocName, acViewPreview, , mfilter2
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, stDocName, acSavePrompt


Someone suggested I use the outputto method, so I changed it to this: and now the mfilter2 which had some parameters in it doesn't seem to have a place in the output2 method.

sOutputFileName = pathname & "\" & stDocNumber & "\" & stDocName & sFileNameSuffix
DoCmd.OutputTo acOutputReport, stDocName, acFormatPDF, sOutputFileName, False

So consequently the wrong report is being put to PDF.

Any ideas?
Go to the top of the page
 
+
rbianco
post Mar 20 2012, 08:41 AM
Post #2

UtterAccess VIP
Posts: 1,730
From: Carrollton, TX



If you want to stay with the OutputTo method, then I suggest passing your filter to a query object, and then have your report use the query as its record source.
Go to the top of the page
 
+
petite39
post Mar 20 2012, 09:03 AM
Post #3

UtterAccess Ruler
Posts: 1,051



Not sure how to do that.....
Go to the top of the page
 
+
rbianco
post Mar 20 2012, 09:53 AM
Post #4

UtterAccess VIP
Posts: 1,730
From: Carrollton, TX



what is the EXACT nature of your filter and its possible parameters? We will find a way to cascade the filter and its parameters into the criteria statemnt of a query. Aslo, what is the current record source of your report?
Go to the top of the page
 
+
theDBguy
post Mar 20 2012, 10:02 AM
Post #5

Access Wiki and Forums Moderator
Posts: 48,018
From: SoCal, USA



Hi,

What version of Access are you using? Knowing the Access version may help us determine a more appropriate response to your question.

QUOTE (petite39 @ Mar 20 2012, 06:35 AM) *
I used to do this:

DoCmd.OpenReport stDocName, acViewPreview, , mfilter2
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, stDocName, acSavePrompt


Someone suggested I use the outputto method, so I changed it to this: and now the mfilter2 which had some parameters in it doesn't seem to have a place in the output2 method.

sOutputFileName = pathname & "\" & stDocNumber & "\" & stDocName & sFileNameSuffix
DoCmd.OutputTo acOutputReport, stDocName, acFormatPDF, sOutputFileName, False

So consequently the wrong report is being put to PDF.

Any ideas?

The initial suggestion was to use OutputTo instead of RunCommand acCmdPrint. So, you can try:

DoCmd.OpenReport stDocName, acViewPreview, , mfilter2, acHidden
sOutputFileName = pathname & "\" & stDocNumber & "\" & stDocName & sFileNameSuffix
DoCmd.OutputTo acOutputReport, stDocName, acFormatPDF, sOutputFileName, False
DoCmd.Close acReport, stDocName

Just my 2 cents... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+
rbianco
post Mar 20 2012, 10:13 AM
Post #6

UtterAccess VIP
Posts: 1,730
From: Carrollton, TX



Sometimes I just read way too much into these questions... (IMG:style_emoticons/default/coffee1.gif) ...back to my coffee
Go to the top of the page
 
+
petite39
post Mar 20 2012, 10:16 AM
Post #7

UtterAccess Ruler
Posts: 1,051



THAT WORKS!!!! Thank you sooooo much! I didn't realize I was replacing only 1 statement and I could keep the rest. This makes my day!
Go to the top of the page
 
+
theDBguy
post Mar 20 2012, 10:19 AM
Post #8

Access Wiki and Forums Moderator
Posts: 48,018
From: SoCal, USA



Hi,

QUOTE (petite39 @ Mar 20 2012, 08:16 AM) *
THAT WORKS!!!! Thank you sooooo much! I didn't realize I was replacing only 1 statement and I could keep the rest. This makes my day!

(IMG:style_emoticons/default/yw.gif)

rbianco and I are happy to help. Good luck with your project.
Go to the top of the page
 
+
rbianco
post Mar 20 2012, 10:40 AM
Post #9

UtterAccess VIP
Posts: 1,730
From: Carrollton, TX



For what it is worth...dbGuy is too kind to "share" the credit! While dynmic filters and parameters in queries can be invaluable at times, My Path would have taken you down a more complicated raod. (Couldn't see the Woods for the Trees kind-a-thing)

Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 07:28 PM