Make a label on a report visible from code

B

BobV

Group:

I want to allow the user decide whether to print a label at the top of a
report by making a selection from a dialog box. After the report is
displayed on the screen (with the label not visible), the user can choose to
make the label visible by making a selection from a menu. Then a dialog box
appears with YES and NO buttons. When the YES button is pressed, I want the
label that is currently not visible to become visible. However, I must not
be referencing the label on the report correctly because when the dialog box
closes the label is still not visible. Here is my VBA code behind the YES
Button:

Private Sub YesButton_Click()
DoCmd.Close acForm, "TradeInElectionDialog"
Reports![Schedule11-2005Form4562-1].Controls![TradeInLabel].Visible =
Yes
End Sub


What is the correct code statement to make the label visible?

Thanks,
BobV
 
K

Ken Snell \(MVP\)

The code to change the visibility of a label must be run from the Format
event of the section in the report where the label is located; you cannot
affect the visual appearance of a report's controls, etc. from an outside
object.

What code causes the dialog form to show? Where are you running that code?
 
R

Rich

BobV said:
Group:

I want to allow the user decide whether to print a label at the top of a
report by making a selection from a dialog box. After the report is
displayed on the screen (with the label not visible), the user can choose to
make the label visible by making a selection from a menu. Then a dialog box
appears with YES and NO buttons. When the YES button is pressed, I want the
label that is currently not visible to become visible. However, I must not
be referencing the label on the report correctly because when the dialog box
closes the label is still not visible. Here is my VBA code behind the YES
Button:

Private Sub YesButton_Click()
DoCmd.Close acForm, "TradeInElectionDialog"
Reports![Schedule11-2005Form4562-1].Controls![TradeInLabel].Visible =
Yes
End Sub


What is the correct code statement to make the label visible?

Thanks,
BobV


Bob,


Use True not Yes...

Reports![Schedule11-2005Form4562-1].Controls![TradeInLabel].Visible =


Rich
 

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