Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Table only opens in VFP 6

Table only opens in VFP 6

Table only opens in VFP 6

Hi all;
I have a table that only opens in VFP 6.0. If i try to open in in VFP 9.0 it returns a massage that the table is corrupt.

RE: Table only opens in VFP 6

Then your table is really corrupt. VFP9 does a more thorough check before opening a table, so a table with a "hidden" error may be opened in earlier versions while VFP9 correctly reports that it is corrupted. But it will also help you fix it.

lcTable = 'yourcorrupettable.dbf'
lcTemp = 'temp' + sys(2015)
lnTableValidate = set("TableValidate")
set tablevalidate to 0
use (lcTable) exclusive 
copy to (lcTemp)
append from (lcTemp)
set tablevalidate to lnTableValidate 

Note that it's extremely important to leave the tablevalidate value at a high value except while you fix a corrupted table!


RE: Table only opens in VFP 6

If you still have a copy of VFP 6, then the obvious solution is to open the table in 6, then copy it to a new table. Copy the actual data to a new table; don't just copy the physical file.

One way to do that would be:

USE OldFile IN 0

If the file is part of a database, add the DATABASE clause to the COPY TO. And don't forget to include path names if necessary.




Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Table only opens in VFP 6

tbleken and MikeLewis thanks for your reply.
I have VFP 6.0. I opened the table in 6 and copied the table to a new table and the new table worked well.

The strange thing that i tried to repair the table with DBF doctor it also could not open the table and said some thing about the data environment.

Any ideas about what caused this?

RE: Table only opens in VFP 6

I don't know dbf doctor, how aged is that tool? If it doesn't know VFP9 dbfs it can't repair them.
Besides both the solutions had/have a danger in them.

Being able to open a dbf in VFP6 still does not tell VFP6 to "understand" the table. If it contains new field types introduced in VFP7-9, VFP6 can't cope with them, also not copy them.
And copying to e temp.dbf, zapping the dbf and append back can not only crash at the wrong time, the copy to might cuase shortened names and data could not appended back fully.

The simplest reapir would just open the dbf in tablevalidate set to 0, append blank, delete - these two steps correct the reccount of the dbf header, then pack to get rid of the new empty record which could be harmful with any next append blank, if there are indexes enforcing a uniqueness of values, you can't append blank twice in such tables before the blank record has got its individual values and not removing the blank record with PACK could cause that later when the application needs to APPEND BLANK.

All that is only repairing the reccount header defect, if you had more serious defects you can't repair in such ways.

You lost a record, at least, a record not getting into the dbf has caused the reccount to get higher than the number of real records and VFP9 checks file whether file length is in conjunction with the header. But it's not the only possible defect, there are more serious.

Bye, Olaf.

RE: Table only opens in VFP 6

Read the link I sent you, it describes why VFP6 does NOT report the problem.

RE: Table only opens in VFP 6

Thanks you all for your help

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close