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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Open table as don't have a *.dbc file

Status
Not open for further replies.

taz75

Programmer
Apr 17, 2001
15
GB
Dear All,

We only work with standalone FoxPro tables, so only deal with *.dbf, *.cdx and *.idx. I have a table which I created, but for some reason it won't let me open this without a *.dbc file, which doesn't and has never existed.

Does anyone know how I can get round this?

This is the first time I have had this problem in 4 years of working with FoxPro in this way.

Thanks in advance for any help,
Kind Regards,

Laura
 
taz75

Posting the error message might help discover the problem.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
When I try to open the table it says

"File 'p:\clients\active\c\cranfield.dbc' does not exist."

FYI my table I am trying to open is in
'p:\clients\active\c\cranfield\p031008\conduit data\'

and 'p:\clients\active\c\cranfield\' is a folder.

Let me know if you need anything else,
Cheers,
Laura
 
taz75

It seems that this table "was" at some point part of a database (either by error or not). If you do not want this table to be part of a database, just open the table exclusively in the command window and once the message the allows you to locate the database pops-up, one of the option is to delete the database reference in the table, things should go back to normal after that.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Use this program to remove references to dbc's in dbf's.
Rob.

* ClearDBCRef.prg
close all
set safe off

dimension dbfhdr[32]
infile=space(30)
CLEAR
@ 5,5 say 'Name DBF with extention ' get infile
read
STORE FOPEN(infile,12) TO fh && Open the file
STORE FSEEK(fh, 0, 2) TO f_size && Move pointer to EOF
STORE FSEEK(fh, 0) TO f_top && Move pointer to BOF
DO readheader
* find header terminator byte 0x0D
nEnddef=0
FOR x=64 TO f_size-1 step 32
=FSEEK(fh, x,0)
nbyte= ASC(FREAD(fh,1))
IF nbyte= 13 && 0x0D
nEnddef = x+1
EXIT
ENDIF
NEXT
=FSEEK(fh,32,0) && reposition before byte 33 in order to copy field definitions
FOR x=33 TO nEnddef && this covers the field definition area
cChar = FREAD(fh,1)
NEXT

** write 263 '0x00' bytes
=FWRITE(fh,replicate(chr(0),263),263)

= FCLOSE(fh)
RETURN


procedure readheader
nfilesize =FSEEK(fh, 0 ,2) && move pointer to last byte to get filesize
=FSEEK(fh, 0,0) && Move pointer to first byte
bytecount=1
do while bytecount < 33
dbfhdr[bytecount] = fgets(fh,1)
* if you want to see the contents of these bytes
* remove the * from the next line
* ? bytecount,dbfhdr[bytecount]
bytecount=bytecount+1
enddo
return
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top