Disable text box

G

Guest

Hello,

I have a form with a few text boxes on it. There is a set of two text boxes
that need to be enabled/disabled depending on what the user enters. I would
like to have them both enabled when the user enters the form. As soon as the
user enters data into on text box, I would like to disable the other text box
and vice versa. if they enter data in the other text box then disable the
first one. How can I do this?

Thanks!
 
G

Guest

Set the enabled properties of both in design view. Then in the After Update
events of each:
For text1:
Me.text2.Enabled = False
And for text2:
Me.text1.Enabled = False
 
G

Guest

Create a function in the form

Function EnableTextBox()
Me.[TextBox1].Enabled = IsNull(Me.[TextBox2]) Or Me.[TextBox2] = ""
Me.[TextBox2].Enabled = IsNull(Me.[TextBox1]) Or Me.[TextBox1]=""
End Function

Call this function from three events
1. OnCurrent event of the form
2. After Update event of TextBox1
3. After Update event of TextBox2
 
G

Guest

That worked! Thank you so much!

Ofer said:
Create a function in the form

Function EnableTextBox()
Me.[TextBox1].Enabled = IsNull(Me.[TextBox2]) Or Me.[TextBox2] = ""
Me.[TextBox2].Enabled = IsNull(Me.[TextBox1]) Or Me.[TextBox1]=""
End Function

Call this function from three events
1. OnCurrent event of the form
2. After Update event of TextBox1
3. After Update event of TextBox2
--
\\// Live Long and Prosper \\//
BS"D


jped said:
Hello,

I have a form with a few text boxes on it. There is a set of two text boxes
that need to be enabled/disabled depending on what the user enters. I would
like to have them both enabled when the user enters the form. As soon as the
user enters data into on text box, I would like to disable the other text box
and vice versa. if they enter data in the other text box then disable the
first one. How can I do this?

Thanks!
 
G

Guest

Your welcome, Glad I could help

--
\\// Live Long and Prosper \\//
BS"D


jped said:
That worked! Thank you so much!

Ofer said:
Create a function in the form

Function EnableTextBox()
Me.[TextBox1].Enabled = IsNull(Me.[TextBox2]) Or Me.[TextBox2] = ""
Me.[TextBox2].Enabled = IsNull(Me.[TextBox1]) Or Me.[TextBox1]=""
End Function

Call this function from three events
1. OnCurrent event of the form
2. After Update event of TextBox1
3. After Update event of TextBox2
--
\\// Live Long and Prosper \\//
BS"D


jped said:
Hello,

I have a form with a few text boxes on it. There is a set of two text boxes
that need to be enabled/disabled depending on what the user enters. I would
like to have them both enabled when the user enters the form. As soon as the
user enters data into on text box, I would like to disable the other text box
and vice versa. if they enter data in the other text box then disable the
first one. How can I do this?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top