Hi
It appears that you are running that code in a development environment, because you say that the project manager also gets closed.
CLOSE ALL will close all projects open, and all the designers such as forms and views as well along with all databases in all data sessions.
CLOSE ALL DATABASES will close all database open in the current data session. However, you should be aware that VFP also opens the databases, not necessarily in the default data session, but that could be its own private data session. That is the circumstance, when you try to recompile the project, often you get the error, some class is open somewhere or such conditional errors, which vanish once you close and open a project. The point is that these errors will come only under a development environment, where as in a run-time situation, you have complete control of the data session you open and so can close the tables suitably.
In short, you are not doing anything wrong.. but the users packing the tables or recreating the indexes, be better tested in a run-time environment without the development version of VFP on for accuracy.
SET DATABASES TO
* To ensure that all free tables are also closed.
CLOSE TABLES ALL
CLOSE DATABASES ALL
This will take care of run-time situatiion.
In a development environment, this will work correct most of the time.. if the DATA tab of the project manager is not the visible one. If the data tab is open, then there are chances that VFP by default opens the database or some of its tables. So changing to another tab and then issuing the code.. CLOSE DATABASES ALL closes the open tables. This info is faced by me in realisty. I never bothered to go deep into it, since I know to work around by changing the tab when I need, as a secnd nature.
____________________________________________
ramani - (Subramanian.G) 