Controlling the appearance of fields on a form

  • Thread starter Thread starter Rani
  • Start date Start date
R

Rani

Guys I would like to change the appearance of fields of a form according to
the user selection
AKA if the user selects 1 then fields A B C are being displayed if the user
selects 2 then fields D E F are being displayed.

any idea on how do I do that ?

thanks
 
An Option Group with 2 radio buttons could do this. In the AfterUpdate event of the Option
Group you would check the value of the Option Group and then set the Visible property of
the desired controls.

If Me.grpOption = 1 Then
Me.ctlA.Visible = True
Me.ctlB.Visible = True
Me.ctlC.Visible = True
Me.ctlD.Visible = False
Me.ctlE.Visible = False
Me.ctlF.Visible = False
Else
'reverse true/false from the above
End If
 
thanks

Wayne Morgan said:
An Option Group with 2 radio buttons could do this. In the AfterUpdate event of the Option
Group you would check the value of the Option Group and then set the Visible property of
the desired controls.

If Me.grpOption = 1 Then
Me.ctlA.Visible = True
Me.ctlB.Visible = True
Me.ctlC.Visible = True
Me.ctlD.Visible = False
Me.ctlE.Visible = False
Me.ctlF.Visible = False
Else
'reverse true/false from the above
End If
 
is there a way to bound fields A B C in a frame (rectangular for example)
and to do the same with fields D E F and then just switch true and false of
the rectangular ?
 
I can't get textboxes to become part of the frame. Click on the tools in the
toolbox and move the mouse over the frame. The ones that cause the frame to
highlight as you move the mouse over it are the ones you can get to become
part of the frame. One thing I was able to do though, was to draw a frame
over the textboxes and change it's background style from Transparent to
Normal and back again. One thing I noticed about this is that if one of the
textboxes you are trying to hide has the focus, then it will continue to be
visible until it loses the focus.

If you have a whole bunch of textboxes that you need to hide and unhide as a
group, you can name them in a fashion that will let you use a loop to do
this.

txtTextbox1
txtTextbox2
etc.

For i = 1 To 10
Me.Controls("txtTextbox" & i).Visible = True
Next i
 
Use a TabControl with the style set to "None". Now when you hide the
TabControl you also hide the objects on it
 
Back
Top