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

error 1152 at runtime

Status
Not open for further replies.

butchkmd

Programmer
Joined
Nov 13, 2001
Messages
83
Location
US
When the user runs one of my apps they get this error

Cannot access the selected table (Error 1152)
You have attempted to select a table outside the 32K work area range or are attempting to reference a file variable in a table that is not open.

when they click ignore it opens and runs fine. But it's not all the time any Suggestions?
Thanks

 
The first thing you need to do is trace your program to find out what line/command is causing the problem. Depending on what kind of program it is, this can be simple or it can be a real pain :o(

If you can figure out where but not why, feel free to post your code here and one of us should be able to figure out what's wrong.

Ian
 
I don't really find it happening on my system but they run off a server. I use a variable for a filepath I wondered what the likelyhood may be that the the table opens slower that the code runs. But only if the server is doing something else????
************************************************
this is code from start up program

*!* set step on
_screen.hide
do form frmSearch
do form frmSplash

************************************************
this is from the splash screen

PUBLIC pFilePath

SELECT 0
USE p:\immigration\data\Sys_Control

pFilePath = ALLTRIM(Sys_Control.FilePath)
************************************************

Thanks
 
Just based on the message, I'd look for something like:

myalias = 65000
SELECT (myalias)

Perhaps in a certain sequence instead of myalias having "MyTable", it's got a large number in it.

Rick

 
The part that confuses me is this:

"or are attempting to reference a file variable in a table that is not open"

What is a "file variable"?

I can't imagine you're trying to select a work area out of range. It would have to be the second part of the error.

Of course, I've seen VFP give completely unrelated error messages (anyone ever get the one that says "'field' phrase is not found"?) so it might not be, but we gotta go with what we have.

>>I use a variable for a filepath I wondered what the
>>likelyhood may be that the the table opens slower that
>>the code runs.

Doubtful unless you've got your code running in various event methods. When you tell VFP to open a file/table, the program stops and waits until it is open before proceeding.

Ian
 
now, in my search form I use a list box with a data source table that is only populated after an initial sort from the main table. But then wouldn't I get an alias not found error if the datasource table wasn't open?
mabe this is helps...don't know.
 
Just some quick checks here:

1) Sys_Control.FilePath is a Character field?

2) How do you use pFilePath in your program? Please paste a piece of code where you actually use it.

3) Do you know exactly what point the error pops up? Does I know it doesn't always happen, but when it does, is it in the same place each time?

Ian
 
I use the code as follows
filepath is a character field
**************************************
select 0
use alltrim(filepath) + 'reporttable'
**************************************
the sys_control table is the only path hardcoded in the splash screen and that code is shown above the sys_control
field holds the file path ex: c:\immigration\data
As far as I know the error always pops up the same time. Once I call the search form, I call the splash form. When the main talbe is sorted and reporttable is filled I disable the splash form so it goes away as soon as possible. The error comes up while the table is sorting, before the splash screen goes away.

 
You are going to have to put some debugging code in your program to try to isolate the line that is causing the problem. There are several ways you can do this, of course, and I use several different methods depending on how far I have already narrowed it down.

A simple way, as long as you aren't using Top Level Forms, is to use WAIT WINDOW commands to let you know what is being executed. When the error occurs, just look at the last system message to see where it's happening.

Of course, if you can get the Debugger's Trace window to tell you, that's even better.

Another way is to use an ON ERROR routine:
[tt]
ON ERROR DO myErrorProg WITH ;
ERROR(),MESSAGE(),MESSAGE(1),PROGRAM(),LINENO()

PROCEDURE myErrorProg
lParameters nError,cMessage,cMessage1,cProgram,nLineNo
MessageBox("An error has occurred:"+chr(13)+;
chr(13)+;
alltrim(str(nError))+":"+cMessage+chr(13)+;
"Line: "+alltrim(str(nLineNo))+" in "+cProgram+":"+chr(13)+;
cMessage1
[/tt]
It's not always perfectly accurate with the parameters, but it should give you a starting point.

Ian
 
If you do use the on error do, instead of sending the output to your customers screen write the information to an error file, the customer can then email you the error.log file and you can debug the program.

This from Foxpro Help may help you if it is a network timimg problem.

RETRY is useful in error-handling routines. It is frequently used to reexecute a command until a record- or file-locking function succeeds in locking the record or file. You can use SET REPROCESS to control retries of a record- or file-locking function. SET REPROCESS is preferable in most network situations.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top