Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having a Field visible in Report Preview but hiding on Printout

Status
Not open for further replies.

stburkeuk

MIS
Mar 23, 2004
27
0
0
GB
We have a database that contains confidential information.

I have been requested to supress the printing of three feilds on a Access 97 Report but to have them visible on the PrintPreview - much the same as the property on Forms that allow a control to be visible on Screen only/Print only or always.

While I can hide the controls in the _Print event this is triggered when the report is previewed - I am supposeing that I need to be able to identify whether it is the Print Preview that is triggering the event or the command to print.

Does anyone have any ideas how to solve this one - or do I need to have two versions of the report - one with feilds and one without?


Thanks
 
If you define a public variable in a module and then set the value of the variable before printing or previewing, you can make the control visible only when the variable equals a value that you want to use to indicate a print preview situation. To do this I suggest you set the control in the report so that it normally is not visible.
 
Thanks for the clue as soon as I read it I was coding in my head in preperation for work this morning.

I setup a Boolean variable,
When the user selects the PrintPreview commands on the form it activate the following code:-

Code:
    boPrintpreview = True ' To suppress the visible property of the Error Party Feilds on Print only
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
    boPrintpreview = False

Where the string are variables identifing the Report and Filter to be used.

In the _Print event on the Report it evaluates the boolean and dispays the fields.

If the user then prints the form from the standard preview Toolbar the value of boPrintPreview is false and so the fields are not shown.

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top