Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Disable Form Events From Being Triggered

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Disable Form Events From Being Triggered

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Disable Form Events From Being Triggered

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Disable Form Events From Being Triggered

-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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Disable Form Events From Being Triggered

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Events won't Disable! roadkill Excel Discussion (Misc queries) 2 April 26th 06 04:36 PM
disable events while macro is running ben Excel Programming 5 January 24th 05 05:19 PM
Worksheet events - when are they triggered! agarwaldvk[_31_] Excel Programming 1 September 28th 04 01:43 PM
Disable Events wiwi Excel Programming 3 December 29th 03 04:53 PM
Disable Key Events Seth[_3_] Excel Programming 1 October 6th 03 10:28 PM


All times are GMT +1. The time now is 01:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"