?
Solved

on from close ?

Posted on 2003-02-19
8
Medium Priority
?
145 Views
Last Modified: 2010-05-01
Is there a way I can execute code when I click the X button to close the form, so I can do some clean up within my program etc.

thanks -cc
0
Comment
Question by:cscorbet
[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
8 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 80 total points
ID: 7982117

put this in your form code:

private sub Form_Unload(Cancel as Integer)

'' do what you want

end sub
0
 
LVL 18

Expert Comment

by:Sethi
ID: 7982129
Use the QueryUnload event of the form. In case you feel that you have to stop the form from closing set Cancel=True in you code in this event.

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

End Sub
0
 
LVL 1

Expert Comment

by:tgraffham
ID: 7982862
Form events are processed as follows:

Unload, then Deactivate, then Close.

Depending on what you're doing, you could have "scope" issues if using unload and may want to put your code in the Close event.  For most cases, however, either should work just fine.

For a full listing of all the form/subform events and their order of processing, see:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/acconOrderEventsFormsS.asp

Hope this helps,
Tim
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:cscorbet
ID: 7992553
Thank you for all your help, as bobbit31 was the first to sort my problem I will give him the points.

thanks again.
CC.
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7995723
why the 'B' grade?
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7996177
A request has been made to change the grade,  The expert feels the current grade does not fit the criteria of the intended guidelines.  Those guidelines are below.  If no response, I will review this question and grade accordingly..

Computer101
E-E Admin

How Do I Know What Grade to Give?
Although we use an A-D scale here at Experts Exchange, it works differently than, say, school grades. If one or more Experts' proposals are accepted as answers, they should usually be given an A or B grade, since they have taken the time to provide you with a working solution. If a possible solution is incomplete - ask for clarification or details before accepting the answer and grading it. People should not be given lower grades because of incorrect grammar or because you just accepted their answer or comment to close the question. Keep in mind, your question and any follow-up comments should be focused so that there can be a specific answer. The following is a good guideline to follow when grading:

A: The Expert(s) either provided you with a thorough answer or they provided you with a link to information that thoroughly answered your question. An "A" can also be given to any answer that you found informative or enlightening beyond the direct question that you asked.

B: The Expert(s) provided an acceptable solution, or a link to an acceptable solution, that you were able to use, although you may have needed a bit more information to complete the task.

C: Because Experts' reliability are often judged by their grading records, many Experts would like the opportunity to clarify if you have questions about their solutions. If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information; or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. You also have the option here of just asking Community Support to delete the question.

Remember, the Expert helping you today is probably going to be helping you next time you post a question. Give them a fair chance to earn an 'Excellent!' grade and they'll provide you with some amazing support.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 8014275
Per the above discussion by Computer101, the grade has been changed.

Netminder
EE Admin
0
 
LVL 1

Author Comment

by:cscorbet
ID: 8025128
Agreed !
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

762 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