Link to home
Start Free TrialLog in
Avatar of cansevin
cansevin

asked on

Check box Visible

I have code for an "On Current" event of a form. It is working if the value = 1... it doesnt' know what to do if the value isn't. If the value isn't 1, I need the Me.chkBooked to be invisible. Any ideas?

Thanks!
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Try something like this:
Me.chkBooked.Visible = (YourValue =1)

Open in new window

Avatar of cansevin
cansevin

ASKER

I forgot... the code I am using is below. I need to make it "invisible" if the value is not 1

Private Sub Form_Current()

Me.chkBooked.Visible = Me.Frame109.Value = 1

End Sub
Judging by the name, you must be using an Option Group.  You need to also put your code in the AfterUpdate event of your Frame control.

Private Sub Frame109_AfterUpdate()
    Me.chkBooked.Visible = (Me.Frame109.Value = 1)
End Sub

Open in new window


In your OnCurrent event you could use the same code or better still just call the the other procedure, that way there's only one section that needs to be maintained rather than two.

Private Sub Form_Current()
    Call Frame109_AfterUpdate
End Sub

Open in new window


As an aside, I would rename Frame109 to something more appropriate.  Something like:
fraBookingSelection or grpBookingSelection maybe.
Thanks for your help... Much appreciated. I added the "Call" to the Add current.

It is working when the value is 1. It just doesn't know what to do when the value is not 1 (which is to be invisible)

Is there an "Else" code to state that it should be invisible when the value is not 1?
No it should work as this is written. There must be something else going on. Maybe you can upload a copy with just that form?
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
glad I could help...