Toggle Visible Property

Soegstad

Registered User.
Local time
Today, 13:50
Joined
Dec 3, 2003
Messages
53
Easy one

There's probably an easy solution to this but I have been fiddling about it for quite some time now. What I want is to reveal a textbox only when a checkbox is checked.
This is what I have come up with so far.
Code:
If Me![Checkbox] = 1 Then
Me![Textbox].Visible = True
Else
Me![Textbox].Visible = False
End If

I know this works with hiding and revealing forms and subforms, but I can't get it to work on a single textbox.
Thanks
Mads
 
Code:
Me.TextBox.Visible = IIf(CheckBox, True, False)
 
Thanks for your reply mile, but now I'm getting a runtime error 13 - Type mismatch.
Any ideas?
 
Last edited:
:D
Sorry mile, I managed to do a typo. Guess it's a little bit early in the day for me.
Thanks again.
 
I use this, Mile; is the IIf() better?

Me.[Textbox].Visible = Me.[Checkbox]
 
pbaldy said:
I use this, Mile; is the IIf() better?

Me.[Textbox].Visible = Me.[Checkbox]

No, what you have is better; I just never thought of it. :(


Either way, though, the time taken to perform either method is impossible to notice. At least to the human eye.
 
Gotcha. I agree the time difference would be insignificant, I just wanted to be sure there wasn't some flaw with my method I wasn't aware of. Always looking to improve!
 

Users who are viewing this thread

Back
Top Bottom