>>I've got a corrupted memo file that causes error message 'memo file (filename) is damaged' when I try to open the dbf. The dialog box gives me the option to 'Cancel' or 'Repair'. What is VFP doing when I choose repair? I need to write code that looks for this type of memo corruption and then fixes it automatically. This memo corruption seems to be of a particular type because if I hack the memo file to corrupt it, I always get error 41 'memo file is missing or invalid' which doesn't allow the 'Repair' option. I need to be able to distinguish the fixable memo corruption (can't track down an error code for this type) and I need code to repair the memo. Any ideas?
>
>whoops, the error is the same for this type of corruption (error code 41). Now I just need to know how vfp attempts to fix the corruption.
Rather than rolling your own code, I'd recommend looking at SDT (Stonefield Database Toolkit.) They have a set of classes that work in conjunction with their extensions to the DBC that take most of the headaches out of packing, reindexing and repairing many different types of DBF and memo field corruption that can be added to applications that you develop. It does a great deal more than this, but the solid maintenance routines offered by SDT justifies the expense very quickly. And it doesa great deal more than just providing maintenance functions.
If you're using a commercial framework, most of them have hooks built-in to support SDT. If not, it's easy enough to instantiate the SDT managers and call their methods from your own code.