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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Triggering events on textbox change

Status
Not open for further replies.

phudgens

Technical User
Jul 8, 2004
117
US
The following code triggers upon any change in the textbox "MinusICells", including deleting the existing value. I'm trying to get the code to trigger only when the value is actually changed/updated.
Code:
Private Sub MinusICells_Change()
    
    Dim ic As Integer, iCount As Integer, jCount As Integer, iMCells As Integer, iPCells As Integer
    
    If Not IsNumeric(LGRData.MinusICells) Then Exit Sub
    
    Me.ComboBox1.Clear
    
    iMCells = CInt(lgrdata.MinusICells)
    iPCells = CInt(lgrdata.PlusICells)
    iCount = iMCells + iPCells + 1
    
    For ic = 1 To iCount
        Me.ComboBox1.AddItem "Default"
    Next ic
    
End Sub

I've tried _AfterUpdate and _ItemChanged, but neither worked. Does anyone know the correct syntax to get this code to trigger only when the MinusICells textbox value has been updated to a new/different value?
Thanks,
Paul Hudgens
Denver
 
use the bforeupdate and check .oldvalue and .newvalue
 
That worked - thanks! Do you know by any chance how to allow user editing of entries in a combobox? Once the values have been entered, I'd like the user to be able to change them. That doesn't seem possible in a combobox. Is there some other device I need to use?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top