Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
USE ... IN 0 vs. SELECT()
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00612484
Message ID:
00612714
Views:
24
>SELECT() will return the currently selected table area. And hence if there is already a table open in that area, it will be closed and the new one put in its place.

That is not the behavior I was hoping for. Rereading the VFP help, I see that SELECT( ) returns the number of the current work area if SET COMPATIBLE is set to OFF. If SET COMPATIBLE is set to ON, SELECT( ) returns the number of the unused work area with the highest number. So it's another 'gotcha' that I have to deal with as I rework some dBase/DOS programs.

>USE IN 0 will tell it to go into the next available spot, not closing other open tables.

That's what I'm trying to do.

>I believe that USE IN does not select the table afterwards, and you may be best doing
>SELECT 0
>USE gooddata ALIAS ...


My habit it to USE xxx IN 0 ALIAS yyy, and then SELECT alias. That way I force myself to be sure where I'm at, and keep myself out of trouble, especially when setting up relations.
And thanks to Rodolfo for pointing out the extra time the function takes to execute, although I do try and write code that does not open and close tables inside a loop.
Randy Bosma
VFP - Because life is too short to code in something else...
Previous
Reply
Map
View

Click here to load this message in the networking platform