>I'm trying to make a data session private yet updatable. The problem is that the form creates a second data session, but leaves the Fox environment in session 1, so when I issue commands, even from within the form, I get "Cannot find mytable" messages, until I go to the view window and manually change the data session to 2. My quetions is: How do I tell the form where to find its own data session? Hopefully someone can me a simple answer, and perhaps an explanation of why things work this way.
As Colin mentioned, you will be better to use the form data environment to access your tables. In that way, the record pointer made in those tables, etc. will not affect the status of the same tables which may be opened in the default data session.
However, at the startup of your application, you can save the data session id and do SET DATASESSION TO gnDataSessionId to temporary access the tables in the default data session. After the process, you can then switch to your form data session to be back to the current data session.