Microsoft KB Archive/193952

= How to troubleshoot to resolve suspected corruption in Visual FoxPro =

Article ID: 193952

Article Last Modified on 2/24/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 7.0 Professional Edition
 * Microsoft Visual FoxPro 8.0 Professional Edition
 * Microsoft Visual FoxPro 9.0 Professional Edition

-



This article was previously published under Q193952



SUMMARY
When you use Microsoft Visual FoxPro, you may sometimes run into problems. The cause of these problems is not always immediately clear. In such situations, you need a general method or a process of trial and error troubleshooting techniques. The steps in the "More Information" section provide beginning steps for the troubleshooting process. The steps also apply to the distributed application .exe files that are written in Visual FoxPro that you install on client computers.

The first step is to make sure that you have an error free installation of the Visual FoxPro product.

In our experience, if you install the most recent version in the same folder as the previous version, the installation does not complete properly or reliably. This is because all of the files may not update or install correctly.



MORE INFORMATION
 If Visual FoxPro is installed on local computers use the following steps:  Back up your files. Save any files on the computer that you want to keep; especially database (.dbc/.dct/.dcx) files and table (.dbf/.fpt/.cdx) files, as well as other source files such as .pjx, .pjt, .vcx,.vct, .scx,.sct, .mnx .mnt, .frx .frt, and the Config.fpw file. Remove Visual FoxPro completely, and then delete the directory where it was installed.

Note This step is not necessary if you are in Step 3. You need to install into a completely new subdirectory. Close all open or running applications.  Using CTRL+ALT+DELETE opens the system Task Manager allowing you to see what applications are currently running.

Note Do not close Explorer because it is the desktop user interface.  Perform operating system disk error check by using Scandisk or a third-party disk repair tool. These tools check and try to fix any lost clusters on the hard drive. After this, run the Disk Defragmenter utility (in Windows XP) or other tool to optimize the disk.</li></ol> </li> Once again, close all open or running applications, (See step 1c).</li> Install Visual FoxPro into a new or different directory location.  A successful product installation means that you do not receive any errors during the installation. Errors during installation indicate an unreliable installation of Visual FoxPro. If errors occur:  Note any errors during installation process.</li> Boot the machine in Safe Mode or Safe Mode with Networking. Furthermore, temporarily disable any anti virus software.</li> Start at Step 1 again.</li></ol> </li></ol>

Note If this is your second time through this process, try using the Custom, Minimal or Laptop installation, instead of Complete.</li> If Visual FoxPro is installed on network server:  You must have an error free installation of Visual FoxPro.</li> Generally, you cannot perform ScanDisk or other disk integrity checking while a Local Area Network (LAN) or Server is running.</li> Remove and reinstall Visual FoxPro until no installation errors are received.</li></ol> </li> Eliminate all DUPLICATE source code and project files. This includes both network and local drives.  <li>Duplicate files cause multiple problems. Make sure that you retain the correct version of the source or project file, and ONLY the correct one.</li></ol> </li> <li>If your project contains a DATABASE/DBC, VALIDATE the database.

Note Please refer to the OPEN DATABASE command in the Visual FoxPro Help file for details. <ol style="list-style-type: lower-alpha;"> <li>Use the OPEN DATABASE EXCLUSIVE VALIDATE command.

Errors indicate table (.dbf) or index (.cdx) corruption.</li></ol> </li> <li>Clean up the project.

Open your project and then from the Project menu, choose "Clean Up Project".

Errors indicate project (.pjx) file corruption.</li> <li>As a way to test with a different file, USE the file as you would a table (.dbf), copy the .dbf structure to a new file, and append the records from the original table, and rename the files. This method necessitates the creation of a new index (.cdx) file, if needed.

Note The following steps use a sample table (.dbf) file named Customer.dbf.

Database, Project, Screen, Menu, Report, and Label files are actually Table (.dbf) files that have a different extension other than .dbf.

If your file is open in the Visual FoxPro interactive or design environment, close it.

Issue the following commands in the Visual FoxPro Command window:

USE customer.dbf && Must specify extension if other than .dbf. ? RECCOUNT     && Note the number of records in the table. COPY STRUCTURE to newfile.dbf USE newfile.dbf  && Empty file structure without records. APPEND FROM customer.dbf && Bring in records from original table. ? RECCOUNT     && Compare number of records with original file. RENAME customer.dbf to oldcust.dbf RENAME newfile.dbf to customer.dbf

Note A difference in the number of records in the new file as compared to the original file. This is an indicator that file corruption exists in the original file.</li> <li>Test on a different computer or in a different computer environment such as a single user environment if problems occur in a multiuser environment or use a different operating system.</li> <li>If corrupt, the FoxPro resource file may cause problems.

One way to test whether the resource file is a factor is to replace the file. Here are two ways to determine the name and location of the FoxPro resource file: <ol style="list-style-type: lower-alpha;"> <li>You can determine the location of the currently active resource file by using the following FoxPro command:

?SYS(2005)

</li> <li>You can specify the FoxPro resource file in the FoxPro configuration file, named Config.fpw by default. If the resource file specified by the configuration file does not exist, FoxPro creates one. <ol> <li>Use the following FoxPro command to determine the location of the configuration file:

?SYS(2019)

</li> <li>The configuration file is an ASCII text file, which can be edited with any editor that saves it in ASCII text format. The easiest way to edit the currently active FoxPro configuration file is with the following command:

MODIFY FILE SYS(2019)

</li> <li>The configuration file may contain a line of text that specifies the location and name of the resource file, such as follows:

RESOURCE= \foxuser.dbf

If so, comment that line out by placing an asterisk (*) at the beginning of the line.</li> <li>Add a new line such as the following:

RESOURCE= \newjunk.dbf && Any name of your choice.

</li> <li>Restart FoxPro for the new setting to take effect.</li></ol> </li></ol> </li> <li>Create a log file that contains the results of the preceding steps for future reference.</li></ol>

<div class="references_section">