-1

I have had to create an extra form for an old Foxpro 2.6 dos database. I am using:

SELECT DISTINCT Conref,  Conref + ", " +  STR(ProdQty) + ", " + Produce
  FROM c:\temp\tempconx.dbf 
  INTO ARRAY unselected 
  ORDER BY Conref, ProdQty, Produce

To populate the array unselected. The problem is this seems to create some temp files for the array. If I rerun the form I get a file in use error. I have tried "RELEASE unselected" in the cleanup section, but still have the same problem.

If I view the temp folder I can see the files appear as the array is created and disappear as the database .exe file that runs the program is closed. I can then run the .exe file again and run the form without the error.

Any idea, how to remove the array temp files without closing the .exe file?

Thank You

Navnish Bhardwaj
  • 1,687
  • 25
  • 39
  • The "file is in use" error cannot possibly have anything to do with the array unselected, because that's not a file. Arrays do NOT create temp files. Are you sure you're not running into a problem with, say, exclusive use of a DBF? – Tamar E. Granor Sep 05 '14 at 20:38

1 Answers1

0

When doing a select, if the table is already opened by the same name as the FROM referenced name, it should just use that. If said table is opened as another name (for whatever reason), it will probably choke that the table is already in use.

If this "C:\Temp\TempConx.dbf" is the culprit, you could always recreate that into a "CURSOR" (but that is read-only without some special smoke-and-mirrors to open again as read-write if you DO need to edit data from temp result table.

Anyhow, if the table is pre-opened, or already exists, you might want to look into

SET SAFETY OFF

which if you try to recreate the file (and not opened), it will allow you to overwrite without the nag of ... file already exists....

Additionally, if you probably need to pre-check/close the temp table by doing something like...

if used( "TempConx" )
   select TempConX
   use
endif 

if file( "C:\Temp\TempConx.dbf" )
   erase "C:\Temp\TempConx.dbf"
endif 


select * ;
   from SomeOtherTable ;
   where SomeCondition ;
   into table C:\Temp\TempConx.dbf;
   order by ...
DRapp
  • 47,638
  • 12
  • 72
  • 142