With ... End

Howlsta

Vampire Slayer
Local time
Today, 19:48
Joined
Jul 18, 2001
Messages
180
Does anyone know if there is a quicker way of doing the below rather than declaring all the visibilities one by one. I thought about the with ... end but as there are more than 1 controls in the below I'm not convinced it can be done.
Any Ideas folks?

Sub ShowCtl()


Me.fsubMarks.Visible = False
Me.cboYear.Visible = False
Me.txtStudent.Visible = False
Me.cboSelectModule.Visible = True
Me.TxtAvg.Visible = False
Me.txtStuAvg.Visible = False
Me.cmdGo.Visible = False
Me.txtName.Visible = False
End Sub

Rich
 
Food for thought. This simple function shows how to cycle through controls and reverse the visibility of each control based on a specified criteria. You may be able to adapt it to your needs.

Public Function ReverseVisability(FormName As String)
' This procedure will reverse the visability of any
' controls identified with Tag = "Fixit"

Dim thisform As String, F As Form, x As Integer

thisform = FormName
Set F = Forms(thisform)

For x = 0 To F.Count - 1
If F(x).Tag = "Fixit" Then
F(x).Visible = Not F(x).Visible
End If
Next x

End Function

[This message has been edited by raskew (edited 08-26-2001).]
 

Users who are viewing this thread

Back
Top Bottom