Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to recreat index?

Status
Not open for further replies.

benzhaotb

Technical User
Dec 25, 2001
46
US
How do I start fox and receat index? I am not a programer. I am using a fox2.6a application on window NT 2000 for a clinical microbilogy lab. The messenge "Index does not match table, Recreat Index appear when we start the application. I try to reinex it with Fox2.6 a but I can not do it. Please hel. Thanks.
 
Hi
**********************************************
** Purpose ... ReIndex Tables in a directory
** Author .... Subramanian.G
** HowRun..... 1. Start FoxPro
** ... 2. SET DEFA toMyDataDirectory
** ... 3. DO REINDEX
*********************************************
SET EXCLUSIVE ON
LOCAL aFiles, nCount, I
DIMENSION aFiles(1,1)
nCount = ADIR(aFiles,"*.DBF")
=ASORT(aFiles,1)
I=1
FOR I = 1 TO nCount
WAIT WINDOW "Reindexing "+aFiles(I,1)+ ;
" ... Please wait" NOWAIT
SELECT 0
USE (aFiles(I,1))
REINDEX
USE
WAIT CLEAR
ENDFOR
SET EXCLUSIVE OFF
*********************************************
** (Not related.. but I am just putting the code
** for use of members)
** To pack files in the same way...
*********************************************
** Pack All Files
SET EXCLUSIVE ON
LOCAL aFiles, nCount, I
DIMENSION aFiles(1,1)
nCount = ADIR(aFiles,gcDataPath+"*.DBF")
=ASORT(aFiles,1)
I=1
FOR I = 1 TO nCount
WAIT WINDOW "Packing "+aFiles(I,1) ;
+" ... Please wait" NOWAIT
SELECT 0
USE (aFiles(I,1))
PACK
USE
WAIT CLEAR
ENDFOR
SET EXCLUSIVE OFF
*********************************************************

Hope this helps :) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
The code above by Ramani will work well as long as your index
files have not been corrupted.

If the index file has been corrupted, then you will be faced with some more difficult options.

1. To see if you have a backup of the original index file - perhaps from a month ago or so since recent ones might also be corrupted.
If so, then restore the single specific index file (.CDX or .IDX) and then REINDEX.

2. To closely examine the existing tables to see if you might have one which contains the necessary information to re-build the index file.

3. (Last resort) To decompile the program with ReFox and examine the code to see how the indicies for that table are used and then to build a new index file.

Good Luck
jrbbldr
jrbbldr@yahoo.com

 
Thank you very much. I will try it and let every if works.
 
Hi;
I needed detailed instruction from ramani. Do I have to typ those codes to the my program? After I start fox, what I do? Thank you for your patient.
 
Great. I just find a old copy of my trobled table and paste it back. Now it is running, Thanks veryone. Have a nice holiday.
 
Hi, can I aks you about using foxpro db throught ODBC?

I want set exclusive on and pack my db, cause my db not affected insert sql command.

Do you know something about it?

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top