OK, I give up - Hiding stuff with Option buttons

Nightowl4933

Tryin' to do it right...
Local time
Today, 11:55
Joined
Apr 27, 2016
Messages
151
Hello.

I'm trying to hide fields and labels on a simple form using the following After Update Event Procedure of a Frame:

Private Sub Frame614_AfterUpdate()

If Me.Frame614.Value = 1 Then
With Me
.Expiry.Visible = False
.Limit.Visible = False
.Text560.Visible = False
End With
ElseIf Me.Frame614.Value = 2 Then
With Me
.Expiry.Visible = True
.Limit.Visible = False
.Text560.Visible = True
End With
ElseIf Me.Frame614.Value = 3 Then
With Me
.Expiry.Visible = False
.Limit.Visible = True
.Text560.Visible = True
End With
End If

End Sub

...except it doesn't work :banghead:

I've also tried something similar with the GotFocus Event Procedure of an Option button as follows:

Private Sub Option617_GotFocus()
With Me
.Expiry.Visible = False
.Limit.Visible = False
.Text560.Visible = False
End With
End Sub

...but this doesn't work either.

Would some kind soul tell me how I can achieve this simple task, please?

Thank you.
 
Hmm, I would use a Select Case statement...

Code:
 Private Sub Frame614_AfterUpdate()

Select Case Me.Frame614.Value
Case 1
    Me.Expiry.Visible = False
   Me.Limit.Visible = False
   Me.Text560.Visible = False
Case 2
   Me.Expiry.Visible = True
   Me.Limit.Visible = False
   Me.Text560.Visible = True
Case 3 Then
   Me.Expiry.Visible = False
   Me.Limit.Visible = True
   Me.Text560.Visible = True
End Select

End Sub
 
Thanks, GinaWhipp. I thought I tried that too, but I'lluse your code and see how I get on.

This is a bit of a puzzle for me!

Thanks,

Pete
 
Well, I tried that, but to no avail. It seems to make logical sensethat your code should work, but absolutely nothing happens - not even an error code.

I was wondering if I'd done something wrong when adding the Option Group.

Pete
 
Have you confirmed the Label names? Oh, and the Option Groups name?
 
you can simplify your code further - once you have names correct

Expiry.Visible = Frame614=2
Limit.Visible = Frame614=3
Text560.Visible= Frame614<>1
 
Of course, if I'd had my security settings configured correctly...

D'oh!

Thank you :-)
 
Oh, so problem solved... thanks for posting back!
 

Users who are viewing this thread

Back
Top Bottom