Another textbox question
I would use a TextBox_Change event to catch changes in the textboxes,
and then check if both textboxes has a valid text:
Private Sub TextBox1_Change()
If Me.TextBox1.Value = "Valid" And Me.TextBox2.Value = "Text" Then
Me.CommandButton1.Enabled = True
Else
Me.CommandButton1.Enabled = False
End If
End Sub
Private Sub TextBox2_Change()
If Me.TextBox1.Value = "Valid" And Me.TextBox2.Value = "Text" Then
Me.CommandButton1.Enabled = True
Else
Me.CommandButton1.Enabled = False
End If
End Sub
Regards,
Per
On 30 Dec., 21:29, "Robert Crandal" wrote:
My userform has 2 textboxes and on push button.
The pushbutton is initially disabled or grayed out.
I would like the pushbutton to become enabled
once BOTH textboxes have been filled in with any
valid text strings. *Also, if the user types data into
both textboxes, but then deletes the text, I would
like to once again disable the pushbutton.
So, in other words, the push button should only be
enabled on the condition that valid text is in both
textboxes.
What is a good way to code this?
Thank you!
|