Brian Hubley
04-04-2002, 11:40 AM
Any help would be greatly appreciated, I've been racking my brain trying to make this work. I have a option button (Cancelled) that when it is Null, I would like the text box (Cancel Date) to be hidden; when checked then display the text box.
Not to get greedy in my quest for knowledge, but would the process be any different for a option button to control a combo box?
Thanks
Brian
alguzman
04-04-2002, 12:03 PM
You can try this. On your form go to the Timer Interval and set it at 1000. Then on then put the following on the ONTIMER event:
If Me.PendingMember = -1 Then
Me.CancelDate.Visible = True
Else
Me.CancelDate.Visible = False
End If
You can play with that. The -1 can be yes or is notnull. Try differet ways until it works.
David R
04-04-2002, 01:00 PM
Rather than the Timer, use the Form's Current event.
Private Sub Form_Current()
If Me.OptionGroup = 2 Then Me.txtBox.Visible = True
End Sub
HTH,
David R
Brian Hubley
04-04-2002, 01:22 PM
Thank you both for responding. I have tried both methods, unfortunatly I was unsuccessful in hidding or making the text box visable. It looks like an either or situation. Do you have any more suggestions?
Brian
David R
04-04-2002, 02:47 PM
You may need to place similar code in the AfterUpdate event of your option group. Make sure it accounts for both making it visible and hiding it. (If your field is saved as invisible, then the form will only need make it visible when the condition is met).
We're not talking about a continuous subform are we? There's known problems with making fields selectively invisible on those.
David R
daveUK
04-05-2002, 12:31 AM
The easiest way is to put the following code under the forms Activate property:
nameoftextbox.visible=false
i.e. txtCancelDate.visible=false
This will 'hide' the text box when the form is displayed. Then on the on_click event of the option button have the following code:
nameoftextbox.visible=true
i.e. txtCancelDate.visible=true
This will also work for combo boxes.
HTH
Dave