Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

exit sub ... end sub ..??!?

Posted on 1999-01-25
4
Medium Priority
?
524 Views
Last Modified: 2010-05-03
what's the different between exit sub and end sub ?

will exit sub make a form stay active (hide but not shown) even when you terminate the application ?

thanks
0
Comment
Question by:tsung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
CraigLazar earned 100 total points
ID: 1470714
Hi
Exit sub - means thath if say you have a procedure or a value thath is reached and you want the execution of your sub routine to stop and not carry on . form still stays open

end sub - means thath the code in a sub routine has all been executed and that object is now finnished

Example - Exit sub
say u put in a validatioon on a field like this
Private sub Field1_lostfocus()
   the value in field1 is either null or a value u are not happy with
i use exit sub like this
if field1 = "" then
   field1.setfocus
   exit sub
end if

or in an error handler you will use exit sub often cause say the user has not filled in correct info so you do not want your app to bom so place an exit sub to prevent it and force the user back to were he should go or give them an message box or something

hope it helps

Craig
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1470715
what is the sub you are using those two on?

0
 

Author Comment

by:tsung
ID: 1470716
like you said Craig, if i use exit sub, this mean the form will not get closed ? then will it be danger if i replace the exit sub with "unload me" ? coz i just have an exprience yesterday that the program didn't get terminate althought the last form got unloaded. and that was happended during the development.
0
 
LVL 4

Expert Comment

by:CraigLazar
ID: 1470717
Well friend u can try that, so so u want to close that form automatically ?
if so i would make a safer rout in thath not firectly replace exit sub with unload me . What i would do is create an small sub routine say called exitform. I would replace your exit sub with
call exitform
in exit form i would then call unload me

try that
ps.if u still have problems or unsure mail me the piece of code and i will look at it for you clazar@softnet.co.za
good luck
Craig

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

722 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