Look at the differences between your SET environment at the command window, in your program and the help topic on SET DATASESSION which lists the SETs that are scoped to private ds forms.
From a message Ed sent in the thread to me, if you change from simple SELECT statements to views you should also be better off. A view is just a SELECT stored in the database, it has a lot more functionality including the ability to be updateable if you want and your tables have primary keys.
>Interestingly enough, I gave the form a private data session this morning (I hadn't ever tried to instantiate more than one, but for some reason it seemed like a good idea.) I have run the form at least 50 times today without encountering the problem once. I have no idea why that made any difference, but it appears that it did.