Change Event ComboBox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bigukfan
    New Member
    • Mar 2010
    • 21

    Change Event ComboBox

    Hi, I have a simple question about setting the value of a variable from a ComboBox. I'm sure this is easy to do, but I can't think of a way right now.

    I have an unbound Form with around 10 ComboBoxes, and I want to set the boolean variable bDirty to True when any on the ComboBoxe values are changed. If the Form was Bound this would be no problem, I could use Form_Dirty, but not for unbound Forms. I could put a line of code in the Change Event for each separate ComboBox, but this is a bit long winded.

    There must be an easier way! Anyone have any suggestions?
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi again bigukfan. I know from your previous question (see this thread) that you are looking to take a short-cut and avoid having code in the after-update events of each control, but there is simply no easier way...

    When you change the contents of a combo box the After Update event is raised. The event sub for that control connects the event to allow you to deal with the event accordingly. At a minimum, there must be an after-update event handler for each control - and at least one line of code to do something as a result of the event.

    It really is not much work to create ten after update subs which set a boolean value in each case - or call another sub to do so if there is more to it than that.

    From the point of view of each control on your form they are all separate instances, not grouped as one entity, and they all raise individual events. You can respond to these or not, but I know of no way of grouping them together into one larger event as you ask.

    -Stewart
    Last edited by Stewart Ross; Aug 12 '10, 12:41 PM. Reason: added thread link

    Comment

    • bigukfan
      New Member
      • Mar 2010
      • 21

      #3
      Hi Stewart,

      That is what I thought, so thanks for your time anyway.

      Comment

      Working...