cancel
Showing results for 
Search instead for 
Did you mean: 

an event is being handled twice instead of once

Former Member
0 Kudos

Hi all

I handle the event of clicking on a button within a user form.

the first time the event is being handled by the code i can see the event appearing in the event logger. the second time the event handling code is being activated the event does not appear in the event logger.

what could be causing this behaviour?

appriciate the help

Yoav

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Yechiel,

Please check the pval.InnerEvent, I have the same problem, and it was an event that was handled twice too, one for InnerEvent = True (Application), and another time for InnerEvent=False (User).

Thks,

Christiano.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Yoav,

I think that you are not yet familiar with the BubbleEvent Property of events. What you are talking about is events being called twice, once for BeforeAction = True and the other for BeforeAction = False.

You actually need to set the BubbleEvent = False once your function has performed its necessary opertaion. This would stop the event from being called twice. for examlpe

If pval.ItemUID = "OK_Button" And pval.BeforeAction = False Then

If MyABCFunction() = True then

BubbleEvent = False

end if

End If

Hope it helps.

Reagrds

Rizwan Hafeez

Team Lead

SAP Addon Development Section

Abacus Consulting - Pakistan

Former Member
0 Kudos

Hi Rizwan

I've added the BubbleEvent = false to my code. but it still get ivoked twice. i also made sure that the code only runs when BeforeAction = false. so according to these the code should be only be called once. yet this is not the case...

appreciate the help

Yoav

Former Member
0 Kudos

Hey YECHIEL,

How do you know the event is being handled twice? Do you display a message box or something? If you are using a debugger I have found this sometimes causes events to fire more then once.

Former Member
0 Kudos

Good point Curtis,

I think it would be helpful if YECHIEL can paste some part of the code along with some description and let us analyse the problem.

Regards

Rizwan

Gianluigi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Every event is raised twice, before and after B1 handle the event itself.

Can you be more precise on which event you are handling and what is it

going wrong there ?

Former Member
0 Kudos

Hi

I handle the click event on BeforeAction = false.

after the event is handled. the code is being called again. when i look at the event logger there is no indication of click event being called again so what is causing the code to get called again?