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!

Cannot access the Selected table when I try to open an another form

Status
Not open for further replies.

mherz715

Programmer
Apr 4, 2012
17
PH
Hi!
"Cannot access the selected table" This is the error that i've encountered when i try to open an another form. I think it because of the combo boxes using the same record source and type.
For example:
In Form1 I have combo box name: loan type
In form2 I also have combobox name: loan type. under the Properties i use the same record source and type (for Form 1 & 2).

I already put some codes like alias, close the tables, etc. just able to open the forms at the same time.

Is there any solution that could prevent this error..

Thanks in advance.
 
I've seen that same error message in the same circumstances that you describe.

One solution would be to ensure that the second form has its own private data session (set the DataSession property to 2). When you do that, keep in mind that, on entry to form 2, none of the tables will be open. You will have to either open them explicitly, or place the tables in the form's data environment.

Give it a try and let us know the result.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thank you for the reply.

I applied it on my form and it works(no error occurred). However, I notice there is a little problem after I set the DATA SESSION into 2. When I open the form2, i notice that before the data is displayed, it shows the query/command w/c supposedly not visible in the form.

Thanks.
 
Are you using TEXT ENDTEXT to prepare a query? Then use the NOSHOW option.

Bye, Olaf.
 
This could be the result of SET TALK.

SET TALK is one of many commands that is scoped to the data session. (See "Commands that Scope to a Data Session" in the help file.) When you use a private data session, all of those settings come with their defaults no matter how you have them set elsewhere.

Most of us use a class in tandem with private data sessions to establish our preferred environment (SET TALK, SET EXACT, etc.)
 
Yes, it does sound like SET TALK is ON.

The simplest way to deal with that is to place your SET commands in the form's Load. Those commands include SET TALK OFF, as well as any others that you like to use in your envrironment.

If you are into object orientation, you can put the commands in the Load event of the parent class, but they will also work in the Load of the form itself.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top