Deleting the entire file should only happen if you issue DELETE FILE ... , i.e. the command starts with those two words in that order.
In your first post, was the DELETE command exactly the same as the one giving you trouble? If the real command giving you trouble is different, what is it? Maybe it includes a reserved word (?)
As I posted before it's possible DELETE FOR could delete all the records, then PACK would subsequently remove them. But that case should not entirely delete the file, just leave you a DBF with no records in it.
>thanks Al
>when I say deletes the file I don't mean deletes the records in the file - I mean the whole file went missing out of the directory.
>it has happened twice with two different files (ie dbf tables). It's like it was reading the first word 'delete' and didn't bother with the rest of the command. So by the time it found the next line 'pack' there was no file left to pack.
>
>k
>
>
>>>I am having an issue that has just suddenly surfaced
>>>in programming when line reads
>>>
>>>Delete for namet = "XNAME"
>>>pack
>>>
>>>
>>>instead of deleting the records selected - VFP deletes the whole file.
>>>
>>>What's going on here?????? Halp!!!!
>>
>>If your field "NameT" is longer than 5 characters (the length of your search string), be aware of partial/inexact string matches. By default, SET EXACT is OFF in VFP.
>>
>>CLEAR
>>
>>CREATE CURSOR Test ;
>> ( NameT C( 6 ) )
>>
>>INSERT INTO Test ( NameT ) VALUES ( "XTEST " )
>>INSERT INTO Test ( NameT ) VALUES ( "XTEST2" )
>>INSERT INTO Test ( NameT ) VALUES ( "XTEST3" )
>>INSERT INTO Test ( NameT ) VALUES ( "XTEST4" )
>>INSERT INTO Test ( NameT ) VALUES ( "XTEST5" )
>>
>>COUNT FOR NameT = "XTEST" TO Result1
>>COUNT FOR NameT == "XTEST" TO Result2
>>COUNT FOR NameT == "XTEST " TO Result3
>>
>>?Result1
>>?Result2
>>?Result3
>>
>>USE IN Test
>>
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up