Executing an Event Procedure 
Author Message
 Executing an Event Procedure

Does anyone know of a way in code to cause an event procedure of a control
to occur from another subroutine?  I have a code tied to the On Click event
of a combo box and I need to execute that code from another subroutine.

In general, how can I execute one subroutine from inside another subroutine?

Thanks for all help!



Thu, 04 Oct 2001 03:00:00 GMT  
 Executing an Event Procedure


Quote:
> Does anyone know of a way in code to cause an event procedure of a control
> to occur from another subroutine?  I have a code tied to the On Click event
> of a combo box and I need to execute that code from another subroutine.

The event handler is just a subroutine, so call the name of that
subroutine.

However, since the code is going to be *shared*, then you would increase
its elegance by putting it in its *own* procedure, which is then called
by both the original event handler and your other routine.

--
Paul Bredbury, http://dialspace.dial.pipex.com/brebs/



Thu, 04 Oct 2001 03:00:00 GMT  
 Executing an Event Procedure
You can use:
MyButton_Click
or:
Call MyButton_Click()

If you are calling it from a procedure outside the form, you would
need to make the click event procedure Public and use:
Form_MyForm.MyButton_Click

If you want to call an event procedure that has parameters (like
BeforeUpdate) you need to pass in a valid value for the parameter(s).

 -- Andy

Quote:

>Does anyone know of a way in code to cause an event procedure of a control
>to occur from another subroutine?  I have a code tied to the On Click event
>of a combo box and I need to execute that code from another subroutine.

>In general, how can I execute one subroutine from inside another subroutine?

>Thanks for all help!



Thu, 04 Oct 2001 03:00:00 GMT  
 Executing an Event Procedure
Andy:

Thank you very much for the help!!

Would you explain more what you mean where you talk about parameters in
event procedures. What kind of parameters? Could you give me some details?

Thank you.


Quote:

>You can use:
>MyButton_Click
>or:
>Call MyButton_Click()

>If you are calling it from a procedure outside the form, you would
>need to make the click event procedure Public and use:
>Form_MyForm.MyButton_Click

>If you want to call an event procedure that has parameters (like
>BeforeUpdate) you need to pass in a valid value for the parameter(s).

> -- Andy


>>Does anyone know of a way in code to cause an event procedure of a control
>>to occur from another subroutine?  I have a code tied to the On Click
event
>>of a combo box and I need to execute that code from another subroutine.

>>In general, how can I execute one subroutine from inside another
subroutine?

>>Thanks for all help!



Fri, 05 Oct 2001 03:00:00 GMT  
 Executing an Event Procedure
I think Andy ment the variables that is transfered to the event-procedure
like this:

'---------------------------------------------

Private Sub opt1999_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)

    'the code goes here ....

end sub

'---------------------------------------------

Here is "Cancel" a parameter of type "MSForms.ReturnBoolean", and you can
refer to it in your code within the event-procedure "opt1999_BeforeUpdate".

To call this routine from a sub:

'---------------------------------------------

Private sub Something()

    opt1999_BeforeUpdate False

end sub

'---------------------------------------------

Here we passed the value "False" to the variable "Cancel" in the
event-procedure "opt1999_BeforeUpdate".

Hope this helps!

Regards,

Oddbjorn Bersas



Fri, 05 Oct 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Unable to execute Oracle Procedure using Ado2.5 - using synonyms for procedures

2. ASAP: How do u set the cmdOK_Click event to have more than one event procedure

3. Any idea how I can execute a procedure / event procedure in another form?

4. Trying to execute a private procedure from another form

5. Execute a SS7 stored procedure

6. executing an extended stored procedure on SQLServer from VBA

7. Access executing stored procedures

8. Executing an oracle stored procedure from access 95

9. Procedure keeps executing after OpenReport

10. Executing procedures

11. execute a variable as a function/sub procedure (like eval function in java(script))

12. problem executing a stored procedure

 

 
Powered by phpBB® Forum Software