making a ontrol visible on report

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
 
M

M.L. Sco Scofield

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
 
F

Fay Yocum

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
 
M

M.L. Sco Scofield

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
 
F

Fay Yocum

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
 

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