>>Just noticed something which I can't believe hasn't tripped me up in the past...
>>
>>If I open a form with a private datasession using DO FORM, then return .f. in the INIT, the datasession stays open, I assume because the reference to that form is not released, but rather converted to .NULL. (according to the debugger).
>>
>>To get around the issue, I've set a flag which I check at the ACTIVATE event, and if need be, release the form there, which eliminates the reference to the form and thus closes the datasession.
>>
>>Is it possible to have the datasession close if I return .f. in the INIT?
>
>Two ways out of this (as far as I can see), one is to return .f. from the form.load, so the DE never gets a chance to exist, or to try thisform.dataenvironment.release from the form.init before returning .f. - which I'm also not quite sure will work (and can't launch Fox right now to try).
Just tried and it doesn't work - DE doesn't have a release method, and can't set it to .null. either (the load returning .f. still works). The only possible reason I think a DE may remain dangling is uncommited changes in some of th ebuffers - a PK violation or something like that.