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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checkbox validation and conditional formatting 1

Status
Not open for further replies.

jeffshex

Technical User
Jun 30, 2005
208
US
Hey all.
Are checkboxes weird with VB Programming?
I have a statement that is like this:

On click event of checkbox

If me.checkbox.value = 1 then
me.text1.locked = false
else
me.text1.value = ""
me.text1.locked = true
end if

Basically, until the checkbox is checked, the user cannot enter information into text1. Once the box is Unchecked, it clears the textbox and locks it.

Seems that the IF statements make it NOT work.
I also use the form current event to check and make sure the checkbox is unchecked (and if it is it locks the text1 textbox.

Anybody have any advice or anything?
 
If me.checkbox.value then


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
This is a forms question ([ignore]forum702[/ignore])

You might find using the after update event of the checkbox control in stead of the on click event to work better, in addition to the on current event of the form. True in VB(A) = -1, so check like demonstrated by PHV or against True/-1.

Roy-Vidar
 
Right on!
That's what I needed to know Roy.
Thanks so much!

-Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top