How to Recover Corrupt Access Forms using SaveAsText / LoadFromText
Improper usage of MS Access database often corrupts its objects like reports, forms, tables, queries, macros, and modules. However, you do not get to know about small corruption issues as Access automatically corrects them; but, if it fails to resolve the corruption, then it either throws an error message or exhibits some unexpected behaviors. You get an error message while updating, deleting, or accessing records, or while running queries, forms, and reports. For handling such situations, Access provides some commands that you can use manually; but, if these manual methods too become unable to fix the issue, then use of an efficient Access database repair software is recommended. One of the undocumented and hidden commands for recovering your data when the forms or reports of your MS Access database get corrupt is SaveAsText / LoadFromText. Using this command, you can export your data to text file and instruct MS Access to recreate it from this text file. Mentioned below are the steps to recover corrupt Access forms and reports.
How to Recover Corrupt Access Forms and Reports
1. First of all before working on your database, it is recommended to make its backup.
2. Look through the modules by opening the code window by pressing CTRL+G. If there is module in this form or report and you can see it, then copy its text on a Notepad, and then save it.
3. Now open the immediate window by pressing CTRL+G and export form or report as text file. Type the below mentioned command:
“SaveAsText acForm, “Form1”, “C:MyFolderForm1.txt””
Replace the Form1 with the name of your form and your directory with MyFolder. However, if you have issue with your report, then replace acForm with acReport.
4. Make sure that the text file that you have created is stored at your specified folder.
5. Now delete the corrupt form from the database by going through the navigation pane (in Access 2007 or later) or database window (in previous versions of Access), and then press ‘Delete’.
6. After that compact your database:
a. To compact your database in Access 2010 use ‘Compact and Repair Database’ option available at ‘Database Tools’ on the ribbon.
b. To compact your database in Access 2007, go to Office button, click ‘Manage >> Compact’.
c. To compact your database in Access 95 – 2003, go to ‘Tools >>Database Utilities >> Compact’.
7. Once again open the immediate window by pressing CTRL+G, and enter the below mentioned text:
“LoadFromText acForm, “Form1”, “C:MyFolderForm1.txt””
Like wise as you replaced ‘Form 1’ in step 3 with the name of your form replace it here as well and replace all the other fields likewise as you did in step 3.
If Access cannot make any sense for the form to export, then you may receive an error message at step 3. In such case, you have to delete and recreate the form, which can be possible if you have saved the code in step 2. Therefore, if step 3 works fine without any error, then there are good chance for the success of rest of the steps as well.
However, if this command fails to do any needful for you, then use of professional Access database recovery software is recommended. These tools repair corrupt forms, reports, and all other database objects and restore your entire database.