[Return to contents]
Repairing corrupt .apr/.vew files (e.g. errors when changing views)
Last updated: 20 Aug 2004 by XpertSS.com
If your application suddenly becomes unstable while you are working in Design Mode on it, you may see crashes simply changing views, strange views with objects from several views mixed together on them, error messages, etc. At that point, you should NOT save the Approach file yet, if you are even able to do so. Consider the following advice from experience with many unfortunate situations I have encountered over the years. :>(
If you have not made many changes since you last saved the Approach file, just close the APR file without saving it and open the prior copy to see if it is OK. Then recreate the changes. But if you have not saved your work and it would take considerable effort to recreate it, or the prior saved copy is similarly damaged, you may want to try to salvage the APR file. Here is how to proceed:
If all else fails, you probably have to simply recreate everything from scratch (using your data (eg .dbf) files of course). But you should never get to this point if you follow good development practices. In particular, you should never save an Approach file over itself without having a backup of it prior to that save. And it is a good practice to use SaveAs often giving the APR file a different name such as myapr_dev01, myapr_dev02, etc.
- First, make sure you have a backup copy of the .APR file from the last time you saved it. You can use the Windows Explorer to copy that file to another folder for safekeeping and then try saving your current .APR file. Then reboot the computer. This may be all you need to do to relieve any shortages of memory or other system resources.
- Open the APR file and see if it works correctly now. If not, try using the File menu, Save As option to another directory to make a new (hopefully error free) version of the .apr and database files.
- If you still have problems, and you can get into design mode, try deleting bits of the last changes you made to see if the problem disappears. It would probably be best to start with things such as text blocks. Sometimes deleting entire views, like form letters in particular, will help. If you cannot get to a view without a crash, try turning off "Show Data" under the "View" menu while in design mode before switching to the view. If you reach a stable point, save the APR file and redo your changes from that point. Review your named Find/Sorts for missing conditions which can happen if you use "Query by box". Delete these and create new ones, and fix the macros that are impacted.
- If you still haven't managed to fix it, try creating a new .apr with all the exact same databases and joins, then import the old APR into it. Note that scripts are not imported so you would need to copy those over manually.
Finally, consider the possibility that the problem or error you are seeing is caused by a corrupt database index. This can cause missing records in repeating panels, Finds that do not find the right records, crashes switching to a view of that database, etc. Try your current APR file with a backup copy of your databases to see if the problem goes away! If so, there are other FAQs on this site that can help you with database and index corruption if you suspect that is the problem.