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

Table Number is Invalid error when I just want to select a table I have 'USED'

Status
Not open for further replies.

dantheinfoman

Programmer
May 5, 2015
131
US
Hi All,

If I have opened a table previously by saying
Code:
USE PVSET IN 0

Doesn't that mean that later on, I should be able to quickly access that table by saying

Code:
SELECT PVSET
???

In this instance, instead. Is says syntax error or table number is invalid. If I say, SELECT PVSET.DBF << it gives a syntax error, if I say SELECT PVSET <<< it says the table number is invalid.

What gives?

I have proven that this table is accessible, because I put in something like this:
Code:
IF !USED('pvset') then
	WAIT WINDOW 'pvset is not used'
ELSE
	WAIT WINDOW 'pvset is used'
ENDIF

and it says that pvset is used.

Anyone know why it's being like this? PS I have several other tables open, but I don't think 250 or whatever the threshold is. . .


Thanks

Dan
 
I was wrong. I used Excel to reveal that my predecessor had popped 273 USE commands. I've lightened this a bit and it's working.

RESOLVED. Sorry guys.

Dan
 
Do you mean that your predecessor had 273 tables opened at the same time? VFP allows 65,535 open tables. That's subject to memory and file handle constraints, but 273 shouldn't be a problem.

Also, I'm puzzled as to how you used Excel to find that number?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike, actually the help adds limited by number of file handles in the footnote, and that is quite unlimted.

The problem most ususally is, something is not USED in 0 and therefore overrides and closes something else.

Also the USE of a table does not mean it's open forever. Closing a form and it's datasession, the table is closed. There is a setting in the dataenvironment called AutoCloseTables, which can be set .F., but that's only really keeping tables open, when the datasession remains, which it does not for forms with private datasession.

Private datasessions are recommended and you would only open tables needed, but you would open them for each form instance, you want them for each form instance, as you want to have independent record pointers/positioning in each form. Otherwise multiple intances of the same form make no sense.

Bye, Olaf.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top