Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you enable or disable a text box in a form based on criteria

Status
Not open for further replies.

williekay

Technical User
Jun 30, 2003
121
US
I have a form that has a field called HM. HM is either going to be a number or an X. I have a combo box that is set to yes or no. I want to disable the combo if HM = X and enable it if Isnumber(HM).

Willie
 
Sure. Create an event procedure in the AfterUpdate event of the HM textbox, something like this:
Code:
Me!ComboName.Enabled = IsNumber(Me!HM)
HTH,

Ken S.
 
OR little elaborated
Code:
Private Sub HM_AfterUpdate()
    If IsNumeric(Me.HM) Then
        Me.ComboName.Enabled = True
    Else
        Me.ComboName.Enabled = False
    End If
End Sub

________________________________________________________________________
Zameer Abdulla
Visit Me
No two children are alike - particularly if one is yours and the other isn't.
 
Is After Update going to work if the HM text box is a calculated control.

Code:
=IIf(DMin("[ID1]","[Production Schedules]","HNumber = " & [HNumber] & " AND SJoin = '" & [Sjoin] & "'")=[ID1],DSum("[PourWeight]","[Production Schedules]","HNumber = " & [HNumber] & " AND SJoin = '" & [Sjoin] & "'")+[KBw],"X")

Willie
 
Try mys solution with OnCurrent Event of the form.

________________________________________________________________________
Zameer Abdulla
Visit Me
No two children are alike - particularly if one is yours and the other isn't.
 
Right. AfterUpdate does not fire if the data is changed programatically.

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top