I have a system that I developed under Visual Foxpro 3.0. I'm encountering
an error. I can't load the system. Well, actually, I can load it, but I
can't select from the main menu (teams & players, season, etc). When I
select it, I get this message: "Error Loading File: loading form or the
data environment - record number 14. Index does not match table. Delete
index file and re-create index."
Which is the index file and how should I delete/recreate it? Why does this
error ocurr?
Thanks for any help. Please send me a copy of the reply message.
Shoaib.
The problem is that your index file(s) have become corrupted. Whenever
you create an index on a table's field, an associated index file is created
for that table. The file should have the extension .CDX by default and have
the same base file name. For example, SEASON.CDX would be the index file
for SEASON.DBF. These index files contain a sorted and compressed list of
each entry made into the indexed field. When the table is opened, the index
file is opened as well, and each time a record is modified in the table
file, it's associated index file is updated. When you perform a seek on an
indexed field, FoxPro will actually peform the search on the index file,
and the index file will point the application to a specific record in the
table. All this is done transparently by FoxPro and should not concern you,
unless the .CDX files become corrupted.
If the index file does not match the table for some season, an error
will occur when the table is opened. Since the table was added to the
form's data environment, it is opened automatically and the error will
occur when you first load the form.
What you need to do is write a re-index procedure to periodically index
your files on a routine (once a week?) basis. It should go something like
this...
set safety off
use <Your table name>
index on <Field Name> tag <Tag Name>
index on <Field Name> tag <Tag Name>
...
...
etc.
close all
There are any number of reasons why your index files would become
corrupted (power surges, PC being turned off by the user, bad network
connection, errors on the hard disk, etc.), and it happens to every FoxPro
application sooner or later.
Shoaib A. Mian <sho...@andrew.cmu.edu> wrote in article
<01bc0ca8$3f823c30$c6600280@supra>...