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

reusing a combo in an application

Status
Not open for further replies.

Bryan - Gendev

Programmer
Jan 9, 2011
408
AU
I'm back to my 'big' app after many months of resting from it - a user has complained (valid too).

Within the app I create a table of (as it happens) path statements as found in memo fields in a table ( they are links to image files) and use this in a combo on a form.

First time in the multi stepped process works as expected and as required.

After this, using a button on a form the user can return to the first step and go through the process again HOWEVER I/they get an error message when trying to open the combo again.

Error is 'Cannot access the selected table, mytable'. From the help this is obviously a VFP gotcha but I can't follow the solution given.

My users want to be able to run the process on any or all of the paths found - one after the other without exiting the application.

Has anyone else any experience with this?

Thanks

GenDev
 
It looks like the table (the one that is used as the combo's RowSource) is no longer open.

You can check that by suspending the program when you get the error, then looking in the Data Session window (or issue ? USED("MyTable") from the Command window).

If that's right, then it's up to you to figure out where it is being closed, and to do something about it. It could be that some subsequent process opens a table in the same work area, for example.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike,

Thanks - I checked that first but that's not the problem -sorry.

The Help message that came up from the [Help] clearly knew the problem existed.

It quotes 'Cannot access the selected table (Error 1152)' with suggestions how to prevent it happening. I can't follow these.

Gendev

 
Error Number 1152 states:
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
.


What is hard to understand?

Mike has already suggested to you that that the Data Table/Cursor that is the ComboBox RowSource is most likely no longer in USE

Have you done as he suggested and set a Breakpoint or used SET STEP ON and looked at the data environment to ensure that that specific data source is in USE and available to the ComboBox?

In light of the fact that the error message continues to be displayed, You say that you have check it, but how did you check it?

Good Luck,
JRB-Bldr



 
I set a breakpoint with STEP and am able to see the table open in the debugger... I'm going to try using a array instead
Thanks.
 
Is the table really the one the combobox is looking for? And are you in the right datasession? Check combobox.rowsource.

Bye, Olaf.
 
Thanks to all that replied.

I changed the combobox rowsource to an array and I can now cycle through the path options as many times as required.

Gendev
 
Gendev,

It's good that you've now got it working, but it's a pity that you haven't solved the original problem. I still feel sure that it was because the file had somehow got closed. Personally, I don't like to discard a problem without discovering the cause. But that's just me, I suppose.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike,

I agree but I firmly believe my use of the debugger showed the table open and available. I needed a solution and 'phew' I'm glad I found one.

My problems always seem to be away from the norm!

I'm about to post another!

Regards

GenDev
 
In the combo code, prior to setting rowsource etc put a simple:
this.rowsource = ""
 
Personally, I don't like to discard a problem without discovering the cause. But that's just me, I suppose.

No, it's not just you.

Problems that "just go away" always come back, generally at the least convenient time. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top