Making a control visible

Lyncroft

QPR for ever
Local time
Today, 03:26
Joined
May 18, 2002
Messages
168
I've a form. On this form I want to place a yes/no field with a default to yes (with a tick). When I deselect that tick I want a subsequent text box to appear. Any ideas?

To put it into context the yes/no field that is set to yes refers to whether the company has a licence. When the box is deselected it means their licence has been revoked and another text box will appear where the date of that revoke took place
 
Hide the control upon opening the form

me.yourfieldname.visible = false

then onclick of your tick box put
me.yourfieldname.visible = true

Hayley
 
Lyncroft,

First, set the text box you want hidden to visible = no in the properties box.

Then put this code in the after update event for the tick box control:

If Me.Yourtickboxname = 0 Then
Me.thetxtboxyourwantvisible.visible = True
Else
End If
End Sub

Hth,
Kevin

[This message has been edited by Kevin_S (edited 05-31-2002).]
 
Set the default to yes (0) in properties of the tick box.

On the AfterUpdate Event of the tick box you can use either Select Case or If then else to set the value of the other box.

Code:
Select Case TickBoxNm
  Case 0
    OtherField.visible = False

  Case Else
    OtherField.visible = True

End Select

You'll need to put it in the OnCurrent event of the form too.

One thing I always do with this, in case the other box has had a value set then the user decides to tick the box and therefore makes the other invisible, is it's a good idea to set the value of the other box to Null (or 0 depending on data type) on the section where you make the other field invisible. Otherwise this defeats the object of having the field invisible.

Add: OtherField.value = Null (or 0)
 
Ah Ally, welcome back to the forum. You've been hiding but Col's been doing a good job in your absence!

Hayley
 
Not to worry - I did a search and think I found what I was looking for. This forum is great!!!
 
Blimey clicked refreshed and lots of tips. Thanks for all your help!
 

Users who are viewing this thread

Back
Top Bottom