making a ontrol visible on report

  • Thread starter Thread starter Fay Yocum
  • Start date Start date
F

Fay Yocum

I want some controls visible only if one other control has been marked yes.
Looking at the books I am trying the following. Obviously it isn't working.
Can you point me in the right direction. Thank you.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(txtReportableOffense) Then
Me!txtReportedTo.Visible = False
Me!txtResultsofOutsideInvest.Visible = False
End If
End Sub



Fay
 
The format event fires for every line and there is no "reset" of anything.
What it was is what it will continue to be unless you change it.

What's that mean? I've got no idea, but it sure sounded good. Nooo...

The first record you hit that txtReportableOffense is null turns off your
other two boxes and they *stay* that way.

You never turn them back on when txtReportableOffense isn't null.

Try this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(txtReportableOffense) Then
Me!txtReportedTo.Visible = False
Me!txtResultsofOutsideInvest.Visible = False
Else
Me!txtReportedTo.Visible = True
Me!txtResultsofOutsideInvest.Visible = True
End If
End Sub

Good luck

Sco

M.L. "Sco" Scofield, Microsoft Access MVP, MCSD, MCP, MSS, A+
Useful Metric Conversion #17 of 19: 1 billion billion picolos = 1 gigolo
Miscellaneous Access and VB "stuff" at www.ScoBiz.com
 
Thanks Sco I got it to work. Since it was a check box the IsNull didn't work
but I changed the IF statement to = 0 and it worked correctly with your
direction below. Fay
 
You're welcome.

Glad you got it to work.

BTW, I got thrown by the "txt" tag on txtReportableOffense.

If it had been chkReportableOffense, I would have suggested turning things
around a little.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If chkReportableOffense = True Then
Me!txtReportedTo.Visible = True
Me!txtResultsofOutsideInvest.Visible = True
Else
Me!txtReportedTo.Visible = False
Me!txtResultsofOutsideInvest.Visible = False
End If
End Sub

Take care...

Sco

M.L. "Sco" Scofield, Microsoft Access MVP, MCSD, MCP, MSS, A+
Useful Metric Conversion #17 of 19: 1 billion billion picolos = 1 gigolo
Miscellaneous Access and VB "stuff" at www.ScoBiz.com
 
You caught me. It was suppose to be chk. I messed up.
I ended up with the second line being
If txtReportableOffense = 0 Then
That worked like it should.

Thanks. Fay
 
Back
Top