Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Open DBF with missing FPT
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01070532
Message ID:
01070543
Views:
12
I don't like replying to my own questions, but I've made some discoveries in the last few minutes that may help some other developers...

1. VFP9 does not care if the FPT file is the one that actually belongs to the DBF, it only seems to care if there is an FPT file matching the name of the DBF. I verified this by simply deleting the employee.fpt file (part of the sample data included with VFP9) and substituting one that belongs to a table created in my application. My table had two memo fields and the employee table has only one memo field. I was then able to open the employee.dbf table, just not copy, pack, reindex, or access the NOTES (memo) field.

2. I was able to copy the structure (using COPY STRUCTURE TO) to a new table and a DBF and FPT file was created.

3. Then I just did a SCAN / ENDSCAN with a SCATTER MEMVAR and a INSERT INTO to copy the data from the DBF with the bad FPT file to the new table. (Recall that you specifically have to add the "MEMO" keyword to the SCATTER command in order to copy it out of the table to memory.)

When I was done, I had a new DBF with all the data from the original DBF, but the data from the FPT file was missing of course.

I have a commercial app and just can't rely on users to backup their data; as much as we emphasized it. The memo file in my app is only used to reference photos and enter additional notes. For many of our users, they will probably never enter data in the memo fields. However, I am anticipating that the FPT file will get deleted and/or corrupted and then I'll be stuck with trying to AT LEAST recover the dat in their DBF file. This routine allows me to do this faily simply.

Naturally, if they have a recent backup, that would be the preferred solution, but in the event they don't have one or the backup is lost or corrupt, then this at least allows me to recover the vast majority of their data.

I hope this information is of use to others...

>We have an application that uses free tables and there is a memo file for one of our critical tables. The question came up, what do we do if the memo file becomes corrupt or separated from the corresponding DBF. When you try to select this file within our application, you get the typical "memo file is missing or invalid". Is there a way to remove the link between the FPT memo file and DBF? The data in the memo file is important, just not nearly as important as the DBF, and of course, we can't rely on the client to backup their data regularly, so we want to at LEAST be able to recover the data in the DBF even if we lose the data in the memo file.
John Fatte'

Life is beautiful!
Previous
Reply
Map
View

Click here to load this message in the networking platform