Call procedure on "On Click" event 
Author Message
 Call procedure on "On Click" event

Hello,

I have a procedure inside a form called "MyProcdure".  How do I call this
procedure from the "On Click" event?  I tried "=MyProcedure" and
"=MyProcedure()".  When I do, I get the error that "Access can't find the
macro '=MyProcedure()" .

--
Thanks in advance,

Steven



Mon, 25 Jul 2005 05:23:12 GMT  
 Call procedure on "On Click" event
hello Steven
in the propertysheet of the commandbutton, select "event
procedure" from the drop-down list and then click the
three dots(...) to the right
this will take you inside the OnClick event in which you
can call whatever procedure you want:

Private Sub Command0_Click()
MyProcedure
...
End Sub

hope this helps
Erez.

Quote:
>-----Original Message-----
>Hello,

>I have a procedure inside a form called "MyProcdure".  
How do I call this
>procedure from the "On Click" event?  I

tried "=MyProcedure" and
Quote:
>"=MyProcedure()".  When I do, I get the error

that "Access can't find the
Quote:
>macro '=MyProcedure()" .

>--
>Thanks in advance,

>Steven

>.



Mon, 25 Jul 2005 06:25:47 GMT  
 Call procedure on "On Click" event

Quote:

>I have a procedure inside a form called "MyProcdure".  How do I call this
>procedure from the "On Click" event?  I tried "=MyProcedure" and
>"=MyProcedure()".  When I do, I get the error that "Access can't find the
>macro '=MyProcedure()" .

If you're typing the function call directly into the
control's OnClick property then it's

        =MyProcedure()

But, note that it must be a function, not a sub.

If you're calling your procedure from within the control's
Click event procedure, then use

        xx = MyProcedure()

if it's a function and you want to use its return value.  If
you don't want to use the return value or if it's a sub,
then just use:

        MyProcedure

--
Marsh
MVP [MS Access]



Mon, 25 Jul 2005 09:18:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VB:Running "On Click" Event

2. Passing "State" Into Called Procedures

3. Run-time error "5": Invalid procedure call

4. "Invalid Procedure Call"

5. replace "keystroke" event with "double click" event

6. "clicking on button without clicking"

7. Need Help "Event Procedure" for the "=" for a calculator

8. Bypassing "Change" and "Click" events in VB controls

9. "Invalid procedure call..." on "txtDim(0).SetFocus"

10. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

11. mailto: requires me to click "Send"

12. "click here" boxes

 

 
Powered by phpBB® Forum Software