visable

C

Chey

I really got myself into a bind. I know there is an easier way
I have 6 checkboxes
and 6 command buttons.
When Check box 1 is checked then I only want to view Command button 1
When Check box 2 is checked Command button 2
and so on.

My command buttons are
For LS
Mary
Nita
For Lewis
For Mary
Non State

My Check boxes are
LS
LS Supervisor
Under Nita
Under Mary
CCPO Supervisor
Non State
When I run my code it only reflects the last part.
Please, please help.

If [LS] = True Then
[For LS].Visible = False
Else
[For LS].Visible = True
End If

If [LS] = True Then
[Mary].Visible = False
Else
[Mary].Visible = False
End If

If [LS] = True Then
[Nita].Visible = False
Else
[Nita].Visible = False
End If

If [LS] = True Then
[For Lewis].Visible = False
Else
[For Lewis].Visible = False
End If
If [LS] = True Then
[For Mary].Visible = False
Else
[For Mary].Visible = False
End If


If [LS Supervisor] = True Then
[For Lewis].Visible = True
Else
[For Lewis].Visible = False
End If

If [LS Supervisor] = True Then
[Mary].Visible = False
Else
[Mary].Visible = True
End If
If [LS Supervisor] = True Then
[Nita].Visible = False
Else
[Nita].Visible = True
End If

If [LS Supervisor] = True Then
[For Mary].Visible = False
Else
[For Mary].Visible = True
End If

If [LS Supervisor] = True Then
[For LS].Visible = False
Else
[For LS].Visible = True
End If

If [Under Nita] = True Then
[Mary].Visible = False
Else
[Mary].Visible = True
End If
If [Under Nita] = True Then
[Nita].Visible = True
Else
[Nita].Visible = False
End If

If [Under Nita] = True Then
[For Lewis].Visible = False
Else
[For Lewis].Visible = True
End If

If [Under Nita] = True Then
[For LS].Visible = False
Else
[For LS].Visible = True
End If

If [Under Mary] = True Then
[Mary].Visible = False
Else
[For LS].Visible = True
End If
If [Under Mary] = True Then
[Nita].Visible = False
Else
[Nita].Visible = True
End If
If [Under Mary] = True Then
[For Lewis].Visible = False
Else
[For Lewis].Visible = True
End If
If [Under Mary] = True Then
[For LS].Visible = False
Else
[For LS].Visible = True
End If
If [Under Mary] = True Then
[For Mary].Visible = True
Else
[For LS].Visible = False
End If
 
O

Ofer

Try something like :

Me.[For LS].Visible = Me.[LS]
Me.[For Lewis].Visible = Me.[LS Supervisor]
Me.[Nita].Visible = Me.[Under Nita]
Me.[For Mary].Visible = Me.[Under Mary]
 
C

Chey

That worked great however when I open the form it gives me an error
Invalid use of Null.
How do I get around this?

Ofer said:
Try something like :

Me.[For LS].Visible = Me.[LS]
Me.[For Lewis].Visible = Me.[LS Supervisor]
Me.[Nita].Visible = Me.[Under Nita]
Me.[For Mary].Visible = Me.[Under Mary]

--
\\// Live Long and Prosper \\//
BS"D


Chey said:
I really got myself into a bind. I know there is an easier way
I have 6 checkboxes
and 6 command buttons.
When Check box 1 is checked then I only want to view Command button 1
When Check box 2 is checked Command button 2
and so on.

My command buttons are
For LS
Mary
Nita
For Lewis
For Mary
Non State

My Check boxes are
LS
LS Supervisor
Under Nita
Under Mary
CCPO Supervisor
Non State
When I run my code it only reflects the last part.
Please, please help.

If [LS] = True Then
[For LS].Visible = False
Else
[For LS].Visible = True
End If

If [LS] = True Then
[Mary].Visible = False
Else
[Mary].Visible = False
End If

If [LS] = True Then
[Nita].Visible = False
Else
[Nita].Visible = False
End If

If [LS] = True Then
[For Lewis].Visible = False
Else
[For Lewis].Visible = False
End If
If [LS] = True Then
[For Mary].Visible = False
Else
[For Mary].Visible = False
End If


If [LS Supervisor] = True Then
[For Lewis].Visible = True
Else
[For Lewis].Visible = False
End If

If [LS Supervisor] = True Then
[Mary].Visible = False
Else
[Mary].Visible = True
End If
If [LS Supervisor] = True Then
[Nita].Visible = False
Else
[Nita].Visible = True
End If

If [LS Supervisor] = True Then
[For Mary].Visible = False
Else
[For Mary].Visible = True
End If

If [LS Supervisor] = True Then
[For LS].Visible = False
Else
[For LS].Visible = True
End If

If [Under Nita] = True Then
[Mary].Visible = False
Else
[Mary].Visible = True
End If
If [Under Nita] = True Then
[Nita].Visible = True
Else
[Nita].Visible = False
End If

If [Under Nita] = True Then
[For Lewis].Visible = False
Else
[For Lewis].Visible = True
End If

If [Under Nita] = True Then
[For LS].Visible = False
Else
[For LS].Visible = True
End If

If [Under Mary] = True Then
[Mary].Visible = False
Else
[For LS].Visible = True
End If
If [Under Mary] = True Then
[Nita].Visible = False
Else
[Nita].Visible = True
End If
If [Under Mary] = True Then
[For Lewis].Visible = False
Else
[For Lewis].Visible = True
End If
If [Under Mary] = True Then
[For LS].Visible = False
Else
[For LS].Visible = True
End If
If [Under Mary] = True Then
[For Mary].Visible = True
Else
[For LS].Visible = False
End If
 
L

Larry

I think your problem is because the checkboxes have no value. You can
solve that using the NZ function.

' In the following case, if the LS checkbox is null, then the NZ
function returns FALSE
Me.[For LS].Visible = NZ(Me.[LS],False)

You could of course change the FALSE to TRUE if you want it to default
to Visible.

HTH
 

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