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

dropping table 1

Status
Not open for further replies.

fishman13

Programmer
Jul 8, 2002
73
US
I use the following procedure to build/drop/pack and recreate tables in my database. I have no problem building, packing recreating, however whan I try to drop the table I get an "invalid table name" message. Why can I create the table, but not drop it. Thanks.

do case
case option = 1
thisform.pageframe1.page1.statusline.caption = "Building Feesched"
thisform.refresh()
if (file("./data/feesched.dbf"))
else
create table ./data/feesched (fee_key c(8), ;
fee_payor c(9), fee_pos c(3), ;
fee_approved Y(8), fee_approv_per n(4.2), ;
fee_exp_pay n(8.2), fee_copay_per n(4.2), ;
fee_copay_amt Y(8), fee_inswarn c(1), ;
fee_code c(8), fee_exppay Y(8), ;
fee_istax c(1), fee_tax_per n(6.4), ;
fee_effdate D, fee_specnum c(15) )

use feesched exclusive
if isexclusive()
index on fee_key tag fee_key1
index on fee_key + fee_payor + fee_pos tag fee_key2
else
endif
endif
case option =2
thisform.pageframe1.page1.statusline.caption = "Recreating FEESCHED"
thisform.refresh()
use feesched exclusive
if isexclusive()
reindex
else
messagebox("File FEESCHED not opened exclusive",16)
endif
case option = 3
thisform.pageframe1.page1.statusline.caption = "Packing FEESCHED"
thisform.refresh()
use feesched exclusive
if isexclusive()
pack
else
messagebox("File FEESCHED not opened exclusive",16)
endif
case option = 4
thisform.pageframe1.page1.statusline.caption = "Dropping FEESCHED"
drop table ./data/feesched
endcase

if used("feesched")
use in feesched
endif
 
fishman13

Your code does not show you opening your database before creating your table. Is it possible its not part of the database?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike

I use a login form which calls this function on initialization. I can also access the table on a form without a problem. I just tried to open the database again before the drop command and it still fails

CLOSE DATA ALL
IF !EMPTY(this.cDataBase)
OPEN DATABASE (this.cDataBase) SHARED
IF EMPTY(DBC())
=MessageBox(FILENOTEXIST_LOC + this.cDataBase, ;
MB_OK + MB_ICONSTOP, ;
ERRORTITLE_LOC)
RETURN .F.
ENDIF
ENDIF
 
fishman1

I have a feeling that if the database is the current database, you don't need the fullpath on the drop table.
Try:
drop table feesched



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top