enable a textfield based on the value in a combo box.

I have a main form and a subform. The main form has a combo box
control and the subform has a textfield.

What I want to do is when the main form loads it should check the
value of the combo box and if it, lets say "MZ" then the textfield in
the subform must be enabled otherwise it should be remain disabled.
This should be done without setting any explicit focus.

Any help would be greatly appreciated.
rakeshv01 [ Di, 08 Januar 2008 23:58 ] [ ID #1902720 ]

Re: enable a textfield based on the value in a combo box.

Rex wrote:

> I have a main form and a subform. The main form has a combo box
> control and the subform has a textfield.
>
> What I want to do is when the main form loads it should check the
> value of the combo box and if it, lets say "MZ" then the textfield in
> the subform must be enabled otherwise it should be remain disabled.
> This should be done without setting any explicit focus.
>
> Any help would be greatly appreciated.

In the MainForm's OnCurrent event you could enter something similar to
Me!SubFormName!Textbox.Enabled = (Me.ComboboxName = "MZ")

Free
http://www.youtube.com/watch?v=nblsi4Ke_qA
Salad [ Mi, 09 Januar 2008 00:27 ] [ ID #1902722 ]

Re: enable a textfield based on the value in a combo box.

Here is one thing you could try:

Private Sub Combo10_AfterUpdate()
If Combo10 = "whatever" Then
Me.frmSubForm.Controls("Text0").Enabled = True
'--or
'Me.frmSubForm.!Text0.Enabled = True
End If
End Sub

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Rich P [ Mi, 09 Januar 2008 01:19 ] [ ID #1903557 ]
Datenbanken » comp.databases.ms-access » enable a textfield based on the value in a combo box.

Vorheriges Thema: Windows XP Registry
Nächstes Thema: Unusual problem with Access 2003 and memory stick