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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Label Visible (or not) On Printed Copy 3

Status
Not open for further replies.

tomco22

Technical User
Sep 16, 2000
74
US
In which event do I place my code so that it will affect the printed copy of the report. I placed this code:
Code:
Select Case Forms!frmOrderEntry _
    .fraConvey.Value
Case 1
    Me.lblFax.Visible = True
    Me.lblPhone.Visible = False
Case 2
    Me.lblFax.Visible = False
    Me.lblPhone.Visible = True
Case 3
    Me.lblFax.Visible = False
    Me.lblPhone.Visible = False
Case 4
    Me.lblFax.Visible = False
    Me.lblPhone.Visible = False
End Select
in "Report_Activate()". It works fine on print preview but it doesn't work when printing a hard copy. Where do I put this code to have the desired effect.

Tom
tomco22
tbrashier@vectormachinery.com
 
I'm not sure exactly what you are doing, but I generally end up with code in the Open event for a Report. Kathryn


 
Kathryn,

That worked. Thank you, thank you, thank you.

What I am doing is a Purchase Order Form. Our engineers use the db to order components from various vendors. At the top of the form they have a set of option buttons: Fax Transmit, Phoned In, Mailed, or blank. Depending on which option button they have depressed I want a label that says "FAX Transmit" for example, to appear on the printed copy of the report.

Anyway, your answer worked for me. Thank you for the speedy & accurate reply.

Tom
tomco22
tbrashier@vectormachinery.com
 
I don't know if this applies to your situation or not, but in reports I use Text Boxes for labels that appear in the detail portion of the report. I do it by having using an iif function to inspect the control (txtTarget) I'm labeling and then set the value of the textbox to a string if the Target is populated or "" if the txtTarget is empty.

=iif(isnull(txtTarget),"","Target's Label:")

Doing this allows you to make labels that "automagically" appear and disappear based on the txtTarget without writing code AND let's you use the grow properties for automatic resizing of report sections.

Joe Miller
joe.miller@flotech.net
 
That's a great tip Joe! I have been trying to work out how to dynamically set the label as visible depending on whether or not a value existed in the field - to no avail! Thanks!

One question though - how would I change the font of the label using the script you have written? I would like to bold the label? Any suggestions?

Thanks

'Amidala'
 
If you always want the label bold, just format it as such using the big 'B' on the toolbar... ;) Otherwise you'll need to run some code in the OnFormat event and check the value of the textbox you want to trigger the bold. If you have Access 2000 or XP, you can also look into conditional formatting which allows you to modify a control's look based on a value (much like conditional formatting in excel.

Joe
Joe Miller
joe.miller@flotech.net
 
LOL! I don't think the 'b' on the toolbar works for an Access report does it? But your comment did reveal that I just needed to set the fontweight to bold for that control! D'oh!

Thanks for your help :) I didn't realise it was a year ago you submitted the thread! Glad you are still around :)

'Amidala'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top