Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing a non-visible field visible 1

Status
Not open for further replies.

Ptrif

Technical User
May 19, 2003
106
0
0
US
On my form i have a check box, i am trying to have a text box become visible only when the check box is checked, i have changed the properties of the text box so that it is not visible and used the following code:

If Check21.Value = "-1" Then text23.Visible = True

When I click on the check box i get the following error:

Run-time error '424':

Object Required

Is the value that im looking for wrong? any suggestions on getting past this?

Any help or suggestions are appreciated.

Thanks

Paul
 
Are both controls on the same form? Make sure you have the spelling correct.
 
I think the problem is related to type matching

When you say

Check21.Value = "-1"

you are trying to compare the boolean value of the CheckBox to the string "-1" when you should be comparing it to -1 or better yet TRUE

Therefore your code should look like

If Check21.Value = True Then text23.Visible = True


However,
you can do away with the If statement altogether

Private Sub Check1_AfterUpdate()
Text23.Visible = Check21.Value
End Sub



Alec Doughty
Doughty Consulting P/L

"Life's a competition. Play hard, but play fair"
 
Alec,

Nice of you to notice that the values of both will always be equal and thats a handy little trick....You get a star!

Thanks, It will help on my database too.

Neo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top