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

Quitting VFP 6.0

Status
Not open for further replies.

PogoWolf

Programmer
Mar 2, 2001
351
0
0
US
Hey all,
I've got a bit of an issue that I'm trying to figure out why it's happening. Basicly, when a user clicks an 'exit' button what's the best way to close everything down and quit the program?

I've tried just 'quit' and FP tells me that it can't quit.
and Close ALL returns a nested error about not being able to find the database, (I assume because I've already closed the connections in other places in the program)

Any suggestions? The PogoWolf
 
PogoWolf

CLEAR EVENTS
QUIT
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
I tried that and I still receive the 'Can't Quit Foxpro' error message. Reading on another website about useing the ON SHUTDOWN command for the clear events.. that didn't help either. I'm not useing read events command, and there's only ONE 'DO' command to open another form for a yes/no question. Does that form need a command to destory it? The PogoWolf
 
It sounds like you have a little bit of a mess and you need to get a fresh start.

I would build a program file (main.prg) and put the following code into it.

set talk off
close all
clear all


do mainmenu.mpr
read events

close all
clear all
return


Then build a menu with the menu builder and put a single option on it to EXIT and in the command for that option put CLEAR EVENTS.

Now run Main.prg and see what happens.

I may have missed a few details here but you get the picture. Make something very simple until you get something that works. Then add a form to the menu options and go from there ...

Good Luck






Don
dond@csrinc.com

 
PogoWolf,
Are suggesting that you have a Single Modal Form on the Desktop (_SCREEN)? If so, then in the QueryUnload() Method, include ThisForm.Release().

Rick
 
Are you sure there are not uncommitted transactions? Try
=TABLEREVERT()
=SQLROLLBACK(sn_ConHandle)

Satyen
 
The program only has two forms, one main and the other as a check to see if the user wants to clean the database (useing ZAP) There's no SQL or transactions used. Compared to a number of programs that I've see on here, mine is a really low end/simple program. =)

I'm not useing the events, and even putting those commands didn't help the problem. The when useing the CLOSE ALL command, the program returns the 'Can't quit Visual FoxPro' error. and the Close DATABASE returns 'can't find table' which believe is being cause by no database connections being open at the time.

I have used the 'builder' from VFP to create the data connections for some drop down boxs, but all other database hits are open, called, and closed.

rgbean suggested to use the ThisForm.RELEASE command, and that worked. Everything shut down. =)

The PogoWolf
 
Hey. Pogo there is a ON SHUTDOWN command in VFP that allows you to set specify a routine to be executed before vfp quits.

You could use it to call a program that close forms and save data before quitting


Eg.
CLEAR EVENTS
CLEAR ALL
CLOSE ALL
RETURN
 
Hey, Dale (at least I assume Dale. =) )
I tried that, and was hit with a bunch of 'Can't find table' errors when it was trying to shut down.. The PogoWolf
 
HI Pogo

If you have a menu with an 'Exit', you can call a procedure (a program) when you write all necessary to exit from your application.
Example:
CLEAR EVENTS
CLOSE DATABASES ALL
CLEAR ALL

You can include many other commands. Example: write in a table that the user with the password exits

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top