Enabling a Text Box based on the Content of another Text Box

yus786

I do OK
Local time
Today, 09:13
Joined
Jun 25, 2008
Messages
121
Hello again

I need something like this.

If the content of TextBox1 is "Yes", then i need the user to be able to view TextBox2.

If the content of TextBox1 is "No", then i need the TextBox2 to be greyed out.

Is this easily done?
 
if [textbox1]="Yes" then
[textbox2].enabled=true
else
[textbox2].enabled=false
end if
 
if [textbox1]="Yes" then
[textbox2].enabled=true
else
[textbox2].enabled=false
end if


Thanks

Where do i put these codes? (I'm a bit of a novice)

Cheers
 
After update event of texbox1

But i'm not actually entering anything into this textbox.

This is a subform that's coming through from somewhere else - ie the data is already populated.

I tried the 'after update' and it didn't work - nothing happening, presumably as the textbox is not getting touched?

Advice?
 
Hi - i'm still struggling with this?

Anyone please help me??
 
I'm not sure what you're saying is going on. You should look at the available events and see which one is most appropriate to your situation.

If I understand you correctly, you may want to use Khawar's code in the "On Current" event. Also, you may try looking at textbox1's "On Change" event. If not, there are dozens of others that may be right...in fact, you may need it in several places, depending on your circumstances.

In my case, when I don't know which is appropriate, I just code all the events with a MsgBox, run my scenarios, and put the code in where the most appropriate MsgBoxs show.
 
you could put it in the forms load code
 

Users who are viewing this thread

Back
Top Bottom