Conditional Reporting - Either View or Print directly to Printer

  • Thread starter Thread starter Gary J. Dikkema
  • Start date Start date
G

Gary J. Dikkema

Is there a simple way to do this?

I have an application where I want to make system wide settings to either
print or print preview the same set of nightly reports...

I know I'll have to condition each report thru a switch but I don't know how
to condition the print.
 
Are you asking how to open a set of reports at a specific time or do you
only need to have a value set somewhere that determines if the opening
reports go to the screen or printer?

If you need a switch to print or view, you can have a form open (possibly
hidden) with an option group set to either preview or print.
 
Thanks Duane!

I have multiple reports and I want the option for each report to print or
preview... the settings for each report I will store in a system/application
control file that the user will update at system startup... the default
being print... this will get their attention very quickly.

Not sure how I would use the option group of a form to print
though...<VBG>... any samples that you could point me to would be
appreciated.

Thanks!
 
Apparently you have code to open the report. Is this in one module or spread
out in many modules. A starting point would be to create a table with all
report names and the mode you want to open them. Use the number 2 for
preview and 0 for printer. You could then use the table to find the open
mode using dlookup()

Dim strReport as String
Dim intMode as integer
strReport = "rptMyReport"
intMode = DLookup("[RptMode]","tblReportModes","[RptName]=""" & strReport &
"""")
DoCmd.OpenReport strReport, intMode
 
Duane!

I think I goofed between what I have and what I thought I would need to do
this. Sorry to mislead you.

So far most of the reports can be printed using the 'point & shoot' aspect.
I am using the MS samples report code to give the user the option to print
any listed report... and I have this spread thru five components of my
application.

However, I realized I'd have to allow the user to make a setting for each
report as to print or preview and the report doesn't change...

And after having said this I realize I need to re-think this a bit.
Obviously if I'm going to auto-print I wouldn't necessarily also list them
or perhaps I would.

I have to make some hard decisions so that the user can't circumvent
'control' reports from those s/he might produce on an adhoc request basis...

However, I can see from your code 'DoCmd.OpenReport strReport, intMode' that
I could automate this...

Thanks Duane!



Duane Hookom said:
Apparently you have code to open the report. Is this in one module or
spread out in many modules. A starting point would be to create a table
with all report names and the mode you want to open them. Use the number 2
for preview and 0 for printer. You could then use the table to find the
open mode using dlookup()

Dim strReport as String
Dim intMode as integer
strReport = "rptMyReport"
intMode = DLookup("[RptMode]","tblReportModes","[RptName]=""" & strReport
& """")
DoCmd.OpenReport strReport, intMode
--
Duane Hookom
MS Access MVP


Gary J. Dikkema said:
Thanks Duane!

I have multiple reports and I want the option for each report to print or
preview... the settings for each report I will store in a
system/application control file that the user will update at system
startup... the default being print... this will get their attention very
quickly.

Not sure how I would use the option group of a form to print
though...<VBG>... any samples that you could point me to would be
appreciated.

Thanks!
 
Back
Top