Mike,
What is ptst1?
If the add method adds something to the _screen in a private datasession, the private can't be released.
You could try Christof Lange's suggestion, which is to use the _VFP.DoCmd method. This adds objects in the Default Datasession, and could avoid your problem.
So, instead of 'ptst1.ADD(opoint)', use:
_VFP.DoCmd( 'ptst1.ADD(opoint)' )
Mace
>I have a form that uses a default datasession. It sometimes happens that when the form is released, the datasession remains as "Unknown(x)" where x is some number. I've managed to narrow down the lines of code that lead to this situation but I have no idea of why or how to prevent the Unknown(x) datasession from happening.
>
>I've investigated other leads regarding datasessions (like here at UT and FoxWiki) and tried to follow their suggesions but nothing I've tried seems to work.
>
>For those who may be interested, I have an ActiveX control (Mapobjects) on a VFP6 form. In a custom method, I put some code, part of which is as follows:
>
>
>SELECT maplist
>SCAN
> pointspcl = placelocator.LOCATE(TRANSFORM(maplist.gis_routen))
>
> IF pointspcl.COUNT > 0
> * The following for loop causes the datasession to become Unknown and I don't know why.
> FOR EACH opoint IN pointspcl
> ptst1.ADD(opoint)
> ENDFOR
> ENDIF
>ENDSCAN
>
>
>If I comment out the three lines in the FOR loop, I don't get the problem. If I comment out the ptst1.Add(opoint) line I don't get the problem.
>
>Is there anyway in VFP6 to destroy an Unknown datasession?
>
>TIA
>
>Mike.