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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form not closing when it should

Status
Not open for further replies.

JRudisill

Programmer
Aug 4, 2003
54
US
I have a form that when it's called it checks to see if there is any employees for a selected agency. If there is not it pops-up a meesagebox and tells the user. The form is then suppossed to release and go back to the select screen. It does not. It loads the form which is blank because there is no employees. I know it is hitting the right routine because I get the messagebox. I have several forms that behave like this. Not sure if I am missing something. Code is below

**Added procedure on form
Messagebox("No employees for selected Agency.",0+16)
thisform.release
do form printagent
 
Hi

1. It is likely that you have not properly constructed the DOEVENTS. You should have this line in your Main.PRG just after calling the first form, for example.

Then only the last form which returns back to the system, should call CLEAR EVENTS.

2. ANother point is that, if do not want to lo0ad a form, after checking some data, you can return .f. in the Init event of the form. Example.. in your employee form.init.. check for loading the employee.. if no employee code passed on or found.. return .f.

:)

____________________________________________
ramani - (Subramanian.G) :)
 
Thanks Ramani. When I issue return .F. in the init() it kicks back out to the calling screen. I Learn something new everyday.
 
A few things: First of all I believe ramani meant READ EVENTS not DOEVENTS. The problem you are having I believe is caused by the fact that you are trying to release the form and then do another line of code.

Messagebox("No employees for selected Agency.",0+16)
thisform.release
do form printagent && how is form supposed to do this line if it is already supposed to be released at this point?

boyd.gif

 
I have tried that several ways. Release before and after the call to the form. I have not come across a difference in that. Returning '.F.' seems to work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top