Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not a table
Message
From
14/05/2002 14:46:53
 
 
To
14/05/2002 13:34:17
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00656252
Message ID:
00656398
Views:
7
>yes
>when triyng to use myform i get not a table, so waht can i do know

Try this - it was some code I wrote back in 1993 but still works on VFP 7. It will typically fix instances of "Not a table" by recalculating the header record count value. Not guarantees but it should not do any additional harm than you already have. Try it on a backup copy.
***********************************************************
*  Program Name:  FIXRECNT.PRG
*        Author:  Thomas D Bellmer     
*       Purpose:  Write correct RECCOUNT() value to header
* Last Modified:  08/11/1993
*         Usage:  DO fixrecnt WITH <dbf name> OR
*                 =fixrecnt(<dbf name>)
*       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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform