Visible Property (1 Viewer)

twinupshot

Registered User.
Local time
Today, 19:42
Joined
Jan 10, 2002
Messages
22
VB ".Visible" help

I have a report that I want to turn certain fields visible when a checkbox field on the form is checked. All of the following If..Then statements work fine by themselves but not together as you see here. I can't seem to figure out how one gets the code to keep executing the statements when the statement above it is "True".

Do I need an ElseIf in there somewhere?

Thanks!
_______________________________________________
Option Compare Database

Private Sub Detail_Format(Cancel As Integer, FormatCount As Interger)
If (Me.RII = True) Then
Me.RII.Visible = True
Else
Me.RII.Visible = False

If (Me.NDT = True) Then
Me.NDT.Visible = True
Else
Me.NDT.Visible = False

If (Me.Engine_print__1 = True) Then
Me.Ctl_1_Engine.Visible = True
Else
Me.Ctl_1_Engine.Visible = False

If (Me.Engine_print__2 = True) Then
Me.Ctl_2_Engine.Visible = True
Else
Me.Ctl_2_Engine.Visible = False
End If
End If
End If
 

RichMorrison

Registered User.
Local time
Today, 13:42
Joined
Apr 24, 2002
Messages
588
Private Sub Detail_Format(Cancel As Integer, FormatCount As Interger)
If (Me.RII = True) Then
Me.RII.Visible = True
Else
Me.RII.Visible = False

If (Me.NDT = True) Then
Me.NDT.Visible = True
Else
Me.NDT.Visible = False

If (Me.Engine_print__1 = True) Then
Me.Ctl_1_Engine.Visible = True
Else
Me.Ctl_1_Engine.Visible = False

If (Me.Engine_print__2 = True) Then
Me.Ctl_2_Engine.Visible = True
Else
Me.Ctl_2_Engine.Visible = False
End If
End If
End If
<<

Try this instead

Private Sub Detail_Format(Cancel As Integer, FormatCount As Interger)
If (Me.RII = True) Then
Me.RII.Visible = True
Else
Me.RII.Visible = False
End If

If (Me.NDT = True) Then
Me.NDT.Visible = True
Else
Me.NDT.Visible = False
End If

If (Me.Engine_print__1 = True) Then
Me.Ctl_1_Engine.Visible = True
Else
Me.Ctl_1_Engine.Visible = False
End If

If (Me.Engine_print__2 = True) Then
Me.Ctl_2_Engine.Visible = True
Else
Me.Ctl_2_Engine.Visible = False
End If


RichM
 

twinupshot

Registered User.
Local time
Today, 19:42
Joined
Jan 10, 2002
Messages
22
I had my code set that way originally, but it did not work. Now I just found an error in my NDT field.I just corrected it and rewrote the code the way you printed it. Works good.

Thanks for the help Rich!

Bryan
 

Users who are viewing this thread

Top Bottom