Solved

terminate executing code

Posted on 1998-05-27
5
159 Views
Last Modified: 2010-05-03
dear sir,

how to stop execute the executing code ?for example, consider the following code. if l ran this code, it would go to test function, now l would like to write a code in test function to stop executing. make sure it won't turn back to msgbox line.but not end the whole program, just to terminate executing the form1 only. how to do it ? if l write with unload function, it would be back to msgbox line.

private sub form_load()
test
msgbox "Test"
end sub

private sub test()
'some code here to stop executing
end sub
0
Comment
Question by:e_aks
  • 3
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
Anita030598 earned 30 total points
ID: 1461778
What's that you are trying to do? Somewhere it will come back.
However you can avoid executing the rest of the lines in Form_Load after test by setting a flag in test. Do it this way:

Dim bFlag As Boolean

private sub form_load()
test
if Not bFlag Then
   msgbox "Test"
end if
end sub

private sub test()
'some code here to stop executing
 bFlag = True
end sub
0
 
LVL 1

Expert Comment

by:Anita030598
ID: 1461779
you can add Unload Me after bFlag = True in test sub if you want the form to be not loaded as well.
0
 

Author Comment

by:e_aks
ID: 1461780
thanks, but is  this just only way to do it ?
0
 
LVL 1

Expert Comment

by:Anita030598
ID: 1461781
As far as I know this is one best and simple way to do.
0
 

Author Comment

by:e_aks
ID: 1461782
ok thanks.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question