Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop one process from another 1

Status
Not open for further replies.

jmcg

Technical User
Jun 30, 2000
223
GB
I have a check sub to ensure a value is selected and want to use this to stop the orignal process.
I don't want to include the check in the process and there are other ones that will use it.
Any help appreciated.
Thanks

Private Sub Process1()
call CheckVal
'process
End Sub

Sub CheckVal()
'check the value
If value =1 Then
'do nothing
Else
'stop processing Process1
End If
 
you can either use END in the CheckVal function which will stop all code execution, however this is rather dangerous...

or you could return a success or fail value from CheckVal then in Process 1, use a if to test wether the check has succeeded or not and then exit sub or continue accordingly...

--------------------
Procrastinate Now!
 
How are ya jmcg . . .

Make [blue]CheckVal[/blue] a function!:
Code:
[blue]Private Sub Process1()
   If CheckVal then
      'process
   End If
End Sub

Function CheckVal() as Boolean
   'check the value
   If value <>1 Then CheckVal = True
End Function[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks guys, like the function way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top