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

cursor with no records doesn't exist?

Status
Not open for further replies.

BlackDice

Programmer
Mar 1, 2004
257
US
It used to be that if I selected fields into a cursor and there were no records returned, I still had a cursor with a reccount() of 0. I re-did my machine and re-installed foxpro (version 7 in both cases). now when I SELECT INTO CURSOR, and there are no records returned, used("mycursor") returns .f. . also a listbox that is using a cursor throws a 'cannot access the selected table' error and disappears from the form if there are no more records in the cursor when the screen refreshes:

I have a form with 2 listboxes populated by 2 different cursors. A button is used to put everything from one cursor into the other one. If I empty out the first one, then call another form, when I come back I get the above-mentioned error for the first listbox that's now empty and the cursor that populated that listbox no longer exists. I never had this problem before I re-installed so I'm wondering is there something in my settings that's different, and if so, what can I do to fix it?

Thanks in advance for any help!

BlackDice

 

I'm not familiar with this behavior (I use VFP6); empty cursor is always created by SELECT statement (not so for an array).

However, to circumvent this, I would first check _TALLY right after the SELECT, and if it is =0, I would not try to access the cursor in question. Just put whatever you have to do with it in IF _TALLY#0 ... ENDIF.
 
that's fine for just the cursor, but it does nothing for the listbox. however, I just tried it again and now it's working - AND I HAVEN'T CHANGED ANYTHING! I hate foxpro

BlackDice

 
I hate foxpro

Hold on now, the proper term is "I hate computers".:)

Regards,

Mike
 
no. I hate foxpro. I love computers. Out of every language I've written programs in (C++, VB6, VBA,PHP) and the ones I've just tried out (javascript,java,delphi), foxpro has to be the worst I've ever dealt with. The IDE, the syntax, the 'one time it does this, one time it does that' feeling, etc.

BlackDice

 

Try this:
Code:
CREATE CURSOR mycursor (name c(1))
USE DBF("MYCURSOR") SHARED AGAIN IN 0
browse


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Well, everyone has their own opinion. Administering a small network, programming, etc. I dont seem to get any more grief from VFP than anything else. So I will stick with "I hate computers", even though they pay the bills.

Regards,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top