>Hi folks
>
>The VFP 6 documentation says that if a memo file is corrupt, you can replace the fpt file with another valid fpt file. The problem I'm having is that after replacing the fpt file,
>
>then packing the file
>then close the file
>then use the file again
>
>I get the VFP dialog to Repair a damaged memo file. Any help or ideas on how to completely replace the FPT file would be helpful.
>
>Here are the steps to reproduce the problem...
>
>create table mytable (name C(20), notes M, dob D)
>
>* now, manually add a few records
>
>* now make a copy of the table and zap it so to create an empty fpt file
>
>COPY TO mytable2
>USE && close the table
>
>USE mytable 2
>ZAP
>USE
>
>* In Windows Explorer, delete the mytable.fpt file. Rename
>* the mytable2.fpt to mytable.fpt
>
>* Now reopen the file, pack, close the file and open it
>
>USE mytable
>PACK
>USE
>USE mytable
>
>* At this point the repair dialog appears.
Peter,
Are you ready to completely get rid of fpt ? If so just changing byte offsett 28 in table header does it :
lparameters cTableName
handle=fopen(cTableName,12)
=fseek(handle,28)
nPokeByte = asc(fread(handle,1))
nWriteByte=bitand(nPokeByte,0xFD)
=fseek(handle,28)
=fwrite(handle,chr(nWriteByte))
=fclose(handle)
If you want you can corparate the changing of field types from M to C in routine. To do this all visually&manually you can execute :
do form (home()+"tools\hexedit\hexedit") with mytable.dbf
Cetin