>My application (.exe) is soon to find a new home a long way from its creator. Eventually, its .dbc, .dbf, dcx, dbc or cdx will corrupt. Every VFP .exe ever created comes with along without warning.
>
>Restoring with a backup is always the last solution. In the short term I want to have a menu option called "Reorganize". What I would like to do is to release the index files and rebuild them programmatically, using Alter table for the pk and fk's and the index command for the other indexes. I have no idea what to do with the validate database command.
>
>Any suggestions?
>
>Thanks
>
>Dallas
Have a "clean" copy of your database - all tables without records. Do an APPEND FROM for each and every table, from the possibly corrupted database (with data), into the empty structure.
In case you use RI, adbobjects("relations") will give you information about parent-child relations (the parent table has to be copied first, to avoid "trigger failed").
I use the above approach for other purposes - to update the database structure.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)