Exit Sub from called Function 
Author Message
 Exit Sub from called Function

Exit Sub from called Function

Lets say Im in a Sub of an OnClick event and I call a
function to do some calculations.  Based on those
calculations I may or may not want to exit the Sub.  How
would I bring back a variable or string from that function
to use in an If Then statement so I can exit that OnClick
event without running some code?

Is this possible or am I going about this the wrong way?

Thanks

Russell



Tue, 26 Jul 2005 00:18:45 GMT  
 Exit Sub from called Function
I think you'd need to do one of two things:  either (1) set the return
value of the function to a special value that will be interpreted by
the calling code as a cancel request, or pass an extra argument
variable to the function that the function will set to a value
indicating a cancel request.  Note that this argument must be passed
ByRef, but that should be no problem since that's the default.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


Quote:
> Exit Sub from called Function

> Lets say Im in a Sub of an OnClick event and I call a
> function to do some calculations.  Based on those
> calculations I may or may not want to exit the Sub.  How
> would I bring back a variable or string from that function
> to use in an If Then statement so I can exit that OnClick
> event without running some code?

> Is this possible or am I going about this the wrong way?

> Thanks

> Russell



Tue, 26 Jul 2005 00:30:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Calling a sub or function using a variable through another sub or function

2. Calling a Function on App Exit - No matter which method is used to exit

3. How to Exit all functions, sub, etc at once

4. Returning sub or function name within a specific sub or function

5. Local function/sub inside function/sub

6. Recursive call and Exit Function

7. Who called this sub or function?

8. Finding called Sub and Functions in code.

9. Calling Sub or Function in another copy of the CURRENT database

10. Calling functions/subs using the string title - possible?

11. Calling a function or sub in Excel from Access

12. Calling function/subs from other databases

 

 
Powered by phpBB® Forum Software