How to make some controls enabled once a value is entered

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I know what I want to do but dont have the VB syntax

If a user enters a certain value in a text box on a form I want about 5
other fields to become Enabled.

The code should be something like this in the On Change (?) field..

If (newVal = "cisco") Then
[Forms]![MyForm]![textbox1] isEnabled
[Forms]![MyForm]![textbox2] isEnabled
......

if someone could spend a couple of minutes to point out the correct vb
syntax I would really appreciate. The boss has finally sent away for a VB
book but it's weeks away =(

cheers
 
Kiwi, Use the after update event. Assuming the name of the control you are updating is "newVal"
try something like:

Private Sub newVal_AfterUpdate()
If Me.newVal = "cisco" Then
Me.[textbox1].Enabled = True
Me.[textbox2].Enabled = True
Else
Me.[textbox1].Enabled = False
Me.[textbox2].Enabled = False
End If
End Sub

Hope this helps!
 
thaaaaaank yoooooouuuu =)

Reggie said:
Kiwi, Use the after update event. Assuming the name of the control you are updating is "newVal"
try something like:

Private Sub newVal_AfterUpdate()
If Me.newVal = "cisco" Then
Me.[textbox1].Enabled = True
Me.[textbox2].Enabled = True
Else
Me.[textbox1].Enabled = False
Me.[textbox2].Enabled = False
End If
End Sub

Hope this helps!
--
Reggie

----------
Kiwi lost in Asia said:
Hi, I know what I want to do but dont have the VB syntax

If a user enters a certain value in a text box on a form I want about 5
other fields to become Enabled.

The code should be something like this in the On Change (?) field..

If (newVal = "cisco") Then
[Forms]![MyForm]![textbox1] isEnabled
[Forms]![MyForm]![textbox2] isEnabled
.....

if someone could spend a couple of minutes to point out the correct vb
syntax I would really appreciate. The boss has finally sent away for a VB
book but it's weeks away =(

cheers
 
Back
Top