I use something like this in my exit code, note, i set closeble to .f. in most cases
lnState = GETFLDSTATE(-1)
IF '2'$lnState OR '3'$lnState OR '4'$lnState
nAnswer = MESSAGEBOX('You Have made changes do you want to Save?',35)
IF nAnswer = 2
RETURN
ENDIF
IF nAnswer = 6
thisform.cmdSave.Click
ENDIF
IF nAnswer = 7
thisform.cmdUndo.Click
endif
ENDIF
> > > Dear All,
> > >
> > > I wanted to excecute save checking procedure before exiting from a form
> > >
> > > More Details :
> > > I have a data entry screen , I wanted to check whether the data entered in the form are saved in the table, there is procedure writen in the from to do that
> > >
> > > Pls tell me which event can be used for this, I have tried lostfocus,unload event and query unload, but none of the events are working
> > >
> > > Jijo David
> >
> > Hi, the QueryUnload event should do it when you exit using the cross button at the top-right of your form (X). For more details you can refer to Tastrade sample shipped with VFP it is done this way. Good luck.
> >
> > Khalil Shaddad (Lebanon)
>
> Khalil is right, but remember that the QueryUnload event doesn't fire when you issue "thisform.Release". So, if you want to have an exit button AND use the X on the window you'll have to have your exit code in two areas or make a custom method you can call from both areas.
>
> ---
>
>
www.foxite.com - The Home of the Visual FoxPro Experts