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

File is not open ???

Status
Not open for further replies.

DaveL

Programmer
Jun 8, 2000
40
US
Why am I getting a "File is not open" error? The following code inserts 1 record into the dave_test table but when it hits the endscan command, it gives me the error. I am trying to get it to loop through cursor4???

Thanks!

Code:
use next_nbr in 2
use dave_test1 in 3
select * from cursor4
scan
SELECT ctr_id from next_nbr 
			m.ctr_id = next_nbr.ctr_id
			REPLACE next_nbr.ctr_id WITH next_nbr.ctr_id + 1

insert into dave_test1(name, dctr_id) ;
values (cursor4.name, m.ctr_id)  
endscan
 

use next_nbr in 2
use dave_test1 in 3
SELECT 2
LOCATE && explicitly locating the record
select * from cursor4

SCAN
m.ctr_id = next_nbr.ctr_id
REPLACE next_nbr.ctr_id WITH next_nbr.ctr_id + 1
INSERT INTO dave_test1(name, dctr_id) ;
VALUES (name, m.ctr_id)
ENDSCAN
================================================
The above shall work for you.

When you write cursor4.name... your assumption cursor4 created by SQL is named cursor4 is wrong. You cannot assume anything with SQL. If you need it specificaly, then you shall create the SQL .. SELECT * from CURSOR4 into DBF myDbf etc etc...
Then use myDBF and select it.

ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Hi Dave,

You don't need to say "select * from cursor4" in order to be able to loop thru cursor4. Rather:

SELECT cursor4
SCAN
...

Also "SELECT ctr_id from next_nbr" is unnecessary. The field "ctr_id" is already available since next_nbr is open.

Jim

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top