Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opening a table with a deleted CDX & Primary key Filter
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00328269
Message ID:
00328316
Views:
32
>Hi Ricardo,
>
>First things first, is the song any good?
>
>Next, for the missing cdx file, I have a client who requires software which can recover under any conditions. In a few rare instances the pc has simply been turned off while in the middle of processing records. This kills the index file and you must recreate the index file. I do a lot of validating upon opening the application, and if the index file does not match the table (error #114), I modify the dbc and then delete the cdx. Then open up the table, alter the table for any primary key info, and then recreate the cdx. This works like a charm except I cannot suppress the dialog box when I open up the table to recreate the cdx. I feel really dense because I can easily do it in the command window, just not in code... Do you have any suggestions?
>
>ps. Thanks for your tip about the primary key filters.
>
>Maria

If I read you correctly, try the following. The on error trap prevents dialogue box:
use mytable exclusive
index on myfield tag myfield
use
erase mytable.cdx
lFailed = .f.
on error lFailed = .t.
use mytable exclusive
*
* table does not open and lFailed = .t.
*
if lFailed
   use mytable exclusive  && this time it opens
endif
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform