How make a control conditionally invisible?

  • Thread starter Thread starter LAS
  • Start date Start date
L

LAS

The detail section of my report is a sub report. In that sub report is a
control that I want to be invisible if a certain control on the main report
is empty. I think the code below should work, but I can't figure out where
to put it. I've tried the sub report's detail Print event and Format event.
Nothing else looks like a candidate. Can someone help?

tia
las

If Nz([Reports]![rptStudentScoresDataSheet]![txtPersonalGoal], "") <> ""
Then
txtPrinciple5.Visible = True
Else
txtPrinciple5.Visible = False
End If
 
Thanks for reassuring me. Only an hour or so before I read your post I
discovered that Format events only trigger in print preview, not report
view. :-)

Marshall Barton said:
LAS said:
The detail section of my report is a sub report. In that sub report is a
control that I want to be invisible if a certain control on the main
report
is empty. I think the code below should work, but I can't figure out
where
to put it. I've tried the sub report's detail Print event and Format
event.
Nothing else looks like a candidate. Can someone help?

If Nz([Reports]![rptStudentScoresDataSheet]![txtPersonalGoal], "") <>
""
Then
txtPrinciple5.Visible = True
Else
txtPrinciple5.Visible = False
End If

The subreport detail section's Format event is the right
place. txtPersonalGoal needs to be in the main report's
detail section or in a group header or the Report header.

BTW, that can be "simplified" to one line:

Me.txtPrinciple5.Visible = Nz(Parent!txtPersonalGoal,"")<>""
 
Back
Top