Make a label on a report visible from code

  • Thread starter Thread starter BobV
  • Start date Start date
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
 
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?
 
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
 
Back
Top