>>>One of my clients has a 900 meg table that is kicking up the error "not a table". I have tried to run the rebfpt program in the files section of this forum (using both fpd 2.6 and vfp 3.0 and get errors like "compiled in wrong version" or "foxtools does not exist". Is there something I need to know about that application or is there a better one out there for this?
>>>
>>>Thanks in advance..
>>>
>>>John Dennis
>>
>>
>>If I remember right, rebfpt fixes memo errors. The problem you are experiencing
>>is due to corruption in the header of the DBF....which *could* cause problems
>>elsewhere in the DBF, but most likely is only in the header. You can order
>>FoxFix from
www.hallogram.com to fix the header.
>
>You can order it or try this freebie that I wrote first...
>
>***********************************************************
>* Program Name: FIXRECNT.PRG
>* Author: Thomas D Bellmer 816/965-2600
>* Purpose: Write correct RECCOUNT() value to header
>* Last Modified: 08/11/93
>* Usage: DO fixrecnt WITH
OR
>* =fixrecnt()
>* Returns: nothing
>***********************************************************
>
>PARAMETERS lcfname
>PRIVATE ALL LIKE l*
>
> *-- Open the file with unbuffered read/write access
>lnhandle = FOPEN(lcfname,12)
>
> *-- Test for possible file opening error
>IF lnhandle = -1
> WAIT WINDOW "Error: "+STR(FERROR(),2)
> RETURN
>ENDIF
>
> *-- Read the first 12 characters of the header
>lchdrinfo =FREAD(lnhandle,12)
>
> *-- Calculate the header length
>lnhdrsize = INT(ASC(SUBSTR(lchdrinfo,09,01)) + ;
> ASC(SUBSTR(lchdrinfo,10,01)) * 256)
> *-- Calculate the record length
>lnreclngth = INT(ASC(SUBSTR(lchdrinfo,11,01)) + ;
> ASC(SUBSTR(lchdrinfo,12,01)) * 256)
>
> *-- lafsize[2] contains the file size in bytes
>=ADIR(lafsize,lcfname)
> *-- Calculate the number of records
>lnreccnt = INT((lafsize[2] - lnhdrsize) / lnreclngth)
>
>lcfirst8 = LEFT(lchdrinfo,4) + SPACE(4)
>FOR lni = 3 TO 0 STEP -1
> *-- Replace characters from left to right starting
> *-- at 8 and going to 5 (RECCOUNT() area)
> lcfirst8 = STUFF(lcfirst8,lni+5,1, ;
> CHR(INT(lnreccnt / 256^lni)))
> *-- Perform modulus division and use the remainder
> *-- as the remaining record count in the next pass
> *-- of the FOR ... NEXT loop.
> lnreccnt = lnreccnt % 256^lni
>NEXT
>
> *-- Go to top of the file.
>=FSEEK(lnhandle,0,0)
> *-- Write 1st 8 positions back to the header record.
>=FWRITE(lnhandle,m.lcfirst8)
> *-- Close the file
>=FCLOSE(lnhandle)
>RETURN
>
>* EOF fixrecnt.prg
This will work ONLY if the problem is the record count is off. There are other errors
that can occur to the header that will cause the "Not a table" error.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer