Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Group,
I have read many of the postings regarding the fact that you can't disable form events. I have even created a Boolean called DisableEvent that I use to escape from the offending event code. My issue that I'm having is that I have 2 comboboxes and when I change the value of Box 1 (From A to B) it needs to clear the value of Box 2. When the Box 2 change event gets triggered the value of the box goes back to the original value (from B back to A) regardless of the fact that I am exiting the procedure before the code is executed. Any ideas? Here's the psuedocode of what's happening. Box1 value is changed from A to B Box1_OnChange DisableEvent = True Change Box 2 value to "" <This will trigger the Box2 Change Event DisableEvent = False .... .... Box2_OnChange <This is when the value goes back to A If DisableEvent = True then Exit Sub ..... ..... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Instead of using the change event, try using the click event.
-- Regards, Tom Ogilvy "JGeniti" wrote in message ups.com... Hello Group, I have read many of the postings regarding the fact that you can't disable form events. I have even created a Boolean called DisableEvent that I use to escape from the offending event code. My issue that I'm having is that I have 2 comboboxes and when I change the value of Box 1 (From A to B) it needs to clear the value of Box 2. When the Box 2 change event gets triggered the value of the box goes back to the original value (from B back to A) regardless of the fact that I am exiting the procedure before the code is executed. Any ideas? Here's the psuedocode of what's happening. Box1 value is changed from A to B Box1_OnChange DisableEvent = True Change Box 2 value to "" <This will trigger the Box2 Change Event DisableEvent = False .... .... Box2_OnChange <This is when the value goes back to A If DisableEvent = True then Exit Sub ..... ..... |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Show us the real code.
-- HTH RP (remove nothere from the email address if mailing direct) "JGeniti" wrote in message ups.com... Hello Group, I have read many of the postings regarding the fact that you can't disable form events. I have even created a Boolean called DisableEvent that I use to escape from the offending event code. My issue that I'm having is that I have 2 comboboxes and when I change the value of Box 1 (From A to B) it needs to clear the value of Box 2. When the Box 2 change event gets triggered the value of the box goes back to the original value (from B back to A) regardless of the fact that I am exiting the procedure before the code is executed. Any ideas? Here's the psuedocode of what's happening. Box1 value is changed from A to B Box1_OnChange DisableEvent = True Change Box 2 value to "" <This will trigger the Box2 Change Event DisableEvent = False .... .... Box2_OnChange <This is when the value goes back to A If DisableEvent = True then Exit Sub ..... ..... |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
-Tom
I only want to trigger the code if the user changes the value. Won't the OnClick event cause the code to be triggered anytime someone clicks into the combobox? -Bob Here is the code. The PackageType combobox is Box1 from my above example. I still left out most of the code for the PackageComponent combobox because there is almost 200 lines of code and the value of PackageType gets changed back to the original value the instant that OnChange event gets called for the PackageComponent. Hopefully this will help. I just can't figure out why calling an OnChange event from within another Onchange would cause the original value to repopulate. Thanks. James Private Sub PackageType_Change() DisableEvent = True PackageComponent.Value = "" DisableEvent = False PackageComponent.RowSource = "" PackageComponent.Visible = False PackageComponentLabel.Visible = False End Sub Private Sub PackageComponent_Change() If DisableEvent = True Then Exit Sub DeletePackageFormControls ..... ..... .... |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Click fires when an item is selected or if the user types in an item in the
list or if you did the equivalent with code. Clearing the combobox did not fire the click event for me. Private Sub CommandButton1_Click() ComboBox1.ListIndex = -1 End Sub Private Sub CommandButton2_Click() ComboBox1.Value = "" End Sub these did not fire the click event for me. -- Regards, Tom Ogilvy "JGeniti" wrote in message ups.com... -Tom I only want to trigger the code if the user changes the value. Won't the OnClick event cause the code to be triggered anytime someone clicks into the combobox? -Bob Here is the code. The PackageType combobox is Box1 from my above example. I still left out most of the code for the PackageComponent combobox because there is almost 200 lines of code and the value of PackageType gets changed back to the original value the instant that OnChange event gets called for the PackageComponent. Hopefully this will help. I just can't figure out why calling an OnChange event from within another Onchange would cause the original value to repopulate. Thanks. James Private Sub PackageType_Change() DisableEvent = True PackageComponent.Value = "" DisableEvent = False PackageComponent.RowSource = "" PackageComponent.Visible = False PackageComponentLabel.Visible = False End Sub Private Sub PackageComponent_Change() If DisableEvent = True Then Exit Sub DeletePackageFormControls .... .... ... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Events won't Disable! | Excel Discussion (Misc queries) | |||
disable events while macro is running | Excel Programming | |||
Worksheet events - when are they triggered! | Excel Programming | |||
Disable Events | Excel Programming | |||
Disable Key Events | Excel Programming |