textbox activated

endri81

Registered User.
Local time
Today, 11:18
Joined
Jul 5, 2010
Messages
121
Hello
I have a textbox where should be entered number 1 or 2 or 3.
For each one of this number a regarding textbox should be activated
For example if I enter in maintextbox number 1 then firsttextbox is activated
If I enter number 2 then secondtextbox is activated
Is this possible to write in VBA?
 
Thank you for response .I write

If Me.TextBoxMain = "1" Then
Me.txtbox1.Enabled = True
Me.txtbox2.Visible = False
Me.txtbox3.Visible = False
End If
If Me.TextBoxMain = "2" Then
Me.txtbox1.Enabled = True
Me.txtbox2.Visible = True
Me.txtbox3.Visible = False
End If
If Me.TextBoxMain = "3" Then
Me.txtbox1.Enabled = True
Me.txtbox2.Visible = True
Me.txtbox3.Visible = True
End If
There is some working first time but then it gets confused or stop working?
Any idea about this issue?
 
If the main textbox contains a number, you'd want:

If Me.TextBoxMain = 1 Then
 
Still not working for me.
I write the code at After Update event procedure.Maybe this is the wrong place?
 
The after update event of TextBoxMain would be the place, yes. Can you post the db?
 
Thank you for response .I write

If Me.TextBoxMain = "1" Then
Me.txtbox1.Enabled = True
Me.txtbox2.Visible = False
Me.txtbox3.Visible = False
End If
If Me.TextBoxMain = "2" Then
Me.txtbox1.Enabled = True
Me.txtbox2.Visible = True
Me.txtbox3.Visible = False
End If
If Me.TextBoxMain = "3" Then
Me.txtbox1.Enabled = True
Me.txtbox2.Visible = True
Me.txtbox3.Visible = True
End If
There is some working first time but then it gets confused or stop working?
Any idea about this issue?

Keep in mind that "Enabled" and "Visible" are two different things. Maybe you just use "Visible" and don't bother with "Enabled".


If Me.TextBoxMain = "3" Then
Me.txtbox1.Visible = False
Me.txtbox2.Visible = False
Me.txtbox3.Visible = True
End If
 

Users who are viewing this thread

Back
Top Bottom