Make a value visible/invisible using a check box

Sniper-BoOyA-

Registered User.
Local time
Today, 12:23
Joined
Jun 15, 2010
Messages
204
Good Morning (for me anyways :D),

Ive got a form which is used to calculate averages. But what i would like to do is to "filter" it by using a checkbox. And the idea is to hide value2 when checkbox1 = True, and to hide value 1 when checkbox2 is true.

Now ive tried it with several IF statements, but up to this point i cant seem to figure it out.

To make things more clear ive added a screenshot.

On the right hand side you see

"Average D7 & D28"

These are the values id like to filter. By using the checkboxes on the left.

Any ideas how to do this? If this is even possible that is...
 

Attachments

  • naamloos.jpg
    naamloos.jpg
    67.7 KB · Views: 106
If you reverse your logic in that you'll hide when your checkbox is false then this should do it:

Private Sub checkbox1_AfterUpdate()
Me.value2 = Me.checkbox1
End Sub

Private Sub checkbox2_AfterUpdate()
Me.value1 = Me.checkbox2
End Sub

JR
 
Thanks for the quick reply JR,

but with

Private Sub checkbox1_AfterUpdate()
Me.avgd28 = Me.checkbox1
End Sub

Private Sub checkbox2_AfterUpdate()
Me.avgd7 = Me.checkbox2
End Sub

It does not respond to the checkbox at all.
 
Sorry forgot an important part

Private Sub checkbox1_AfterUpdate()
Me.avgd28.Visible = Me.checkbox1
End Sub

Private Sub checkbox2_AfterUpdate()
Me.avgd7.Visible = Me.checkbox2
End Sub

JR
 
Thanks again!

But i am sorry to say that nothing happends, even with .visible...

:(
 
Not sure other than perhaps some misspelled controlnames?

See attached for the concept.

JR
 

Attachments

Thanks.

I dont know why it wont work here.

I did find out that VBA gives a compile error, at .Visible...

It sais it cant find the method or .....

Any ideas?

edit: I found out what the problem was. The name of the textboxes had a misspelled name. :rolleyes:

I got it to work now. Thanks for all your help m8.. Cheers!!!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom